I am using this code posted by WebTest:
VB Code:
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.Find.ClearFormatting With Selection.Find .Text = "REPORTING: " .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute Selection.MoveRight Unit:=wdCharacter, Count:=1 Selection.TypeText Text:=" " & strName & " DATE: " & Date
It seeks out the footer in a template document I have set, and successfully prints the document, then closes the document and ms word.
All seems fine until.... I print the next document. Then I get the following:
At this line:
VB Code:
If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
All data inserted into the document succeds, it is when I modify the footer the second time. If I close and restart my application, then it prints fine the first time. Just fails on the footer insert on the second pass.Runtime error '462':
The remote server machine does not exists or is unavailable
This is driving me crazy, why is this happening?![]()




Reply With Quote