Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.word.newusers
perkin5 perkin5 is offline
external usenet poster
 
Posts: 3
Default word 2007 macro

I am trying to record a macro to add the filepath to the page footer.
Having saved the page and recorded the macro, I get an error message:
Run-time error 5941. The requested member of the collection does not
exist.

The debugger shows the following code:

Sub Macro1()
'
' Macro1 Macro
'
'
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty,
Text:= _
"FILENAME ", PreserveFormatting:=True
End Sub
Sub Macro2()
'
' Macro2 Macro
'
'
WordBasic.ViewFooterOnly
ActiveDocument.AttachedTemplate.BuildingBlockEntri es("
Blank").Insert _
Whe=Selection.Range, RichText:=True
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty,
Text:= _
"FILENAME ", PreserveFormatting:=True
End Sub

The two lines beginning 'ActiveDocument...' are highlighted.

Can anyone help me to sort this out?
 
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I change a macro name (word 2007) Compare document don't show changes Microsoft Word Help 1 February 25th 09 07:10 AM
macro in word 2007 [email protected] Microsoft Word Help 2 December 31st 08 07:00 PM
macro in word 2007 [email protected] Page Layout 1 December 29th 08 11:18 PM
Word 2007 Macro Security [email protected] Microsoft Word Help 2 May 20th 08 05:07 PM
Macro toolbars in word 2007 Patrick Microsoft Word Help 1 December 20th 06 06:16 AM


All times are GMT +1. The time now is 01:26 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"