Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 169
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 169
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Format page number in excel footer to start at a specific page # straitctrydncr Excel Discussion (Misc queries) 4 April 28th 23 07:45 PM
PROBLEM:How to squeeze 2 Page sized Chart in Excel 2000 & embed in Word 2000 and print from Word to fit one page ??? [email protected] Excel Discussion (Misc queries) 2 September 10th 08 11:07 AM
PROBLEM:How to squeeze 2 Page sized Chart in Excel 2000 & embed in Word 2000 and print from Word to fit one page ??? [email protected] New Users to Excel 2 September 10th 08 11:07 AM
Excel footer to look like Word footer? Carole O Excel Discussion (Misc queries) 5 June 2nd 08 11:25 PM
How do a set up a footer in Excel for page x of y? Elle Web Excel Discussion (Misc queries) 1 July 12th 06 04:11 AM


All times are GMT +1. The time now is 08:12 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"