Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
add footer page name in word using excel
Hello,
I use excel vba to copy a lot of word file in different folder. I would like to customize each word document by inserting the name of each person in the footer page. Does anyone know how can I do that? (I'm not famillar with word vba) Thanks! example: workbook.open ("test.doc") workbooks("test.doc").insert.foot.page(1) = "..." workbook.close (true) -- Alex St-Pierre |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
add footer page name in word using excel
Hi,
I would suggest you open up Word and have a bit of a play recording macros and editing there. When you're finally happy with it just copy it all to Excel. Personally I find Word VBA a bit messy with all its sections, and things.... not like good old straightforward Excel. However, if this helps: Dim oWord As Word.Application Dim myDoc As Document Set oWord = GetObject("", "Word.Application") Set myDoc = oWord.Documents.Open 'use 1 instead of wdHeaderFooterPrimary if you use late binding myDoc.Sections(1).Footers(wdHeaderFooterPrimary).R ange.Text = "I am a footer" rest of your code... myDoc.save, myDoc.close etc. If it suits your purposes its far easy to make a reference to the Microsft Word Object Library in your Excel project - tehn you can use early binding. Otherwise you will have to change Word.Application and DOcument in the declarations to Object HTH, Gareth "Alex St-Pierre" wrote in message ... Hello, I use excel vba to copy a lot of word file in different folder. I would like to customize each word document by inserting the name of each person in the footer page. Does anyone know how can I do that? (I'm not famillar with word vba) Thanks! example: workbook.open ("test.doc") workbooks("test.doc").insert.foot.page(1) = "..." workbook.close (true) -- Alex St-Pierre |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
add footer page name in word using excel
Hi,
I have copy the codes but I can't execute. I want to open "C:\test.doc" document and add a footer. Dim oWord As Word.Application 'not working Dim myDoc As Document 'not working Set oWord = GetObject("", "Word.Application") 'ok Set myDoc = oWord.Documents.Open 'not working I tried: set myDoc = oWord.Documents.open ("C:\test.doc") but all jammed.. Any idea..? Thanks, Alex "Gareth Roberts" wrote: Hi, I would suggest you open up Word and have a bit of a play recording macros and editing there. When you're finally happy with it just copy it all to Excel. Personally I find Word VBA a bit messy with all its sections, and things.... not like good old straightforward Excel. However, if this helps: Dim oWord As Word.Application Dim myDoc As Document Set oWord = GetObject("", "Word.Application") Set myDoc = oWord.Documents.Open 'use 1 instead of wdHeaderFooterPrimary if you use late binding myDoc.Sections(1).Footers(wdHeaderFooterPrimary).R ange.Text = "I am a footer" rest of your code... myDoc.save, myDoc.close etc. If it suits your purposes its far easy to make a reference to the Microsft Word Object Library in your Excel project - tehn you can use early binding. Otherwise you will have to change Word.Application and DOcument in the declarations to Object HTH, Gareth "Alex St-Pierre" wrote in message ... Hello, I use excel vba to copy a lot of word file in different folder. I would like to customize each word document by inserting the name of each person in the footer page. Does anyone know how can I do that? (I'm not famillar with word vba) Thanks! example: workbook.open ("test.doc") workbooks("test.doc").insert.foot.page(1) = "..." workbook.close (true) -- Alex St-Pierre |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
add footer page name in word using excel
Hi,
This worked for me: Sub PlaceTextInFooter() Dim oWord As Object 'Word.Application Dim myDoc As Object 'Document Set oWord = GetObject("", "Word.Application") Set myDoc = oWord.Documents.Open("c:\test.doc") 'use 1 instead of wdHeaderFooterPrimary if you use late binding myDoc.Sections(1).Footers(1).Range.Text = "I am a footer " myDoc.Save myDoc.Close Set oWord = Nothing Set myDoc = Nothing End Sub Please take note of what I wrote in the previous email regarding making a reference to MS Word in your project - if you don't do that you have to use "late binding" - as I have above. I think you are far better writing this code in Word first before moving it to Excel. HTH, Gareth "Alex St-Pierre" wrote in message ... Hi, I have copy the codes but I can't execute. I want to open "C:\test.doc" document and add a footer. Dim oWord As Word.Application 'not working Dim myDoc As Document 'not working Set oWord = GetObject("", "Word.Application") 'ok Set myDoc = oWord.Documents.Open 'not working I tried: set myDoc = oWord.Documents.open ("C:\test.doc") but all jammed.. Any idea..? Thanks, Alex "Gareth Roberts" wrote: Hi, I would suggest you open up Word and have a bit of a play recording macros and editing there. When you're finally happy with it just copy it all to Excel. Personally I find Word VBA a bit messy with all its sections, and things.... not like good old straightforward Excel. However, if this helps: Dim oWord As Word.Application Dim myDoc As Document Set oWord = GetObject("", "Word.Application") Set myDoc = oWord.Documents.Open 'use 1 instead of wdHeaderFooterPrimary if you use late binding myDoc.Sections(1).Footers(wdHeaderFooterPrimary).R ange.Text = "I am a footer" rest of your code... myDoc.save, myDoc.close etc. If it suits your purposes its far easy to make a reference to the Microsft Word Object Library in your Excel project - tehn you can use early binding. Otherwise you will have to change Word.Application and DOcument in the declarations to Object HTH, Gareth "Alex St-Pierre" wrote in message ... Hello, I use excel vba to copy a lot of word file in different folder. I would like to customize each word document by inserting the name of each person in the footer page. Does anyone know how can I do that? (I'm not famillar with word vba) Thanks! example: workbook.open ("test.doc") workbooks("test.doc").insert.foot.page(1) = "..." workbook.close (true) -- Alex St-Pierre |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Format page number in excel footer to start at a specific page # | Excel Discussion (Misc queries) | |||
PROBLEM:How to squeeze 2 Page sized Chart in Excel 2000 & embed in Word 2000 and print from Word to fit one page ??? | Excel Discussion (Misc queries) | |||
PROBLEM:How to squeeze 2 Page sized Chart in Excel 2000 & embed in Word 2000 and print from Word to fit one page ??? | New Users to Excel | |||
Excel footer to look like Word footer? | Excel Discussion (Misc queries) | |||
How do a set up a footer in Excel for page x of y? | Excel Discussion (Misc queries) |