The following clip of code is OnOpen of a Word document. When opened it will update links to several Templates and documents. The links don't need to repeatedly updated, they list personal information for the individual using that particular machine. The code works fine WHEN the Template/Document is loaded on the machine. When not it errors.
I am sure there is an "easy" way to write if the individual file is not there to move next. I would rather not use "On Error Resume Next". You would think that it was Monday with the blank my mind is drawing.
Sub AutoOpen()
' MacroUpdateLinks Macro
Dim TrkStatus As Boolean
Dim oRange As Object
ChangeFileOpenDirectory "C:\SpecialTax\"
Documents.Open FileName:="""IFTA Follow Up.dot"""
With ActiveDocument
TrkStatus = .TrackRevisions
.TrackRevisions = False
For Each oRange In .StoryRanges
Do
oRange.Fields.Update
Set oRange = oRange.NextStoryRange
Loop Until oRange Is Nothing
Next
.TrackRevisions = TrkStatus
End With
ActiveDocument.Close SaveChanges:=wdSaveChanges
I am sure there is an "easy" way to write if the individual file is not there to move next. I would rather not use "On Error Resume Next". You would think that it was Monday with the blank my mind is drawing.
Sub AutoOpen()
' MacroUpdateLinks Macro
Dim TrkStatus As Boolean
Dim oRange As Object
ChangeFileOpenDirectory "C:\SpecialTax\"
Documents.Open FileName:="""IFTA Follow Up.dot"""
With ActiveDocument
TrkStatus = .TrackRevisions
.TrackRevisions = False
For Each oRange In .StoryRanges
Do
oRange.Fields.Update
Set oRange = oRange.NextStoryRange
Loop Until oRange Is Nothing
Next
.TrackRevisions = TrkStatus
End With
ActiveDocument.Close SaveChanges:=wdSaveChanges