Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / October 2006

Tip: Looking for answers? Try searching our database.

error 5941 debugging help needed.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Walter Alexander - 27 Oct 2006 18:05 GMT
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
Doug Robbins - Word MVP - 28 Oct 2006 15:00 GMT
Why not just set up the field construction in a template from which you
create the document?

Signature

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

>I have set up a macro to insert filename and path in the footer of a
>document
[quoted text clipped - 41 lines]
>
> End Sub
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.