error 5941 debugging help needed.

W

Walter Alexander

I have set up a macro to insert filename and path in the footer of a document
as follows. For some reason this code stops at the line of code midway down
where it is actually putting the info in the footer. All you see in the
document is "IF 1 = 1" on some workstation but not others. All workstations
are using the same image of Office installed some time ago. Does anyone have
any ideas what would cause this to happen??????


' RefTag Macro
' Macro recorded 10/7/2005 by
'
If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _
ActivePane.View.Type = wdOutlineView Then
ActiveWindow.ActivePane.View.Type = wdPrintView
End If
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
If Selection.HeaderFooter.IsHeader = True Then
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
Else
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
End If
Selection.Font.Size = "10"
Selection.TypeText Text:="IF "
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldPage
Selection.TypeText Text:=" = "
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldNumPages
Selection.TypeText Text:=" "
ActiveDocument.AttachedTemplate.AutoTextEntries("Filename and path"). _
Insert Where:=Selection.Range, RichText:=True
Selection.HomeKey Unit:=wdLine, Extend:=wdExtend
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
PreserveFormatting:=False
Selection.EndKey Unit:=wdLine
Selection.Fields.Update
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.Fields.Update
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument

End Sub
 
D

Doug Robbins - Word MVP

Why not just set up the field construction in a template from which you
create the document?

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top