![]() |
#1
|
|||
|
|||
![]()
I have a script to modify a field in a document header:
Code:
WordDoc.ActiveWindow.View.Type = wdPrintView WordDoc.ActiveWindow.ActivePane.View.SeekView = 9 WordDoc.Sections(2).Headers(wdHeaderFooterPrimary).LinkToPrevious = False WordDoc.ActiveWindow.ActivePane.View.SeekView = 0 Dim fg As Field For Each fg In WordDoc.Sections(1).Headers(1).Range.Fields If (InStr(1, fg.Code.text, "{ORDERNR}") > 0) Then fg.Code.text = Replace(fg.Code.text, "{ORDERNR}", "{FONR}") End If Next fg Now for the funny part. After the VBA has run, double clicking on the header and then double clicking back on the document body, this resets the pages to their original state. I have removed line by line and it turns out that to provoke the error it is enough to even have a reference to the Headers(1).Range, without even modifying the content. When I have had similar issues I have forced a refresh by swithcing the view to the header and then back (similar to what I did with the double clicking), but for this problem it doesn't help. Any ideas how to approach this problem to find a solution? This is a Windows Server 2008 R2 installation accessed over Citrix Office 15.0.4859.1001 |
Tags |
vba word headers |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Page Break is adding Blank Page when Break occurs | JoannL54 | Word | 3 | 07-01-2016 05:58 AM |
![]() |
Carlabasson | Word | 2 | 03-25-2013 10:13 PM |
![]() |
Eastendr | Word | 1 | 01-21-2013 05:57 AM |
![]() |
dkgolfer16 | Word | 2 | 05-23-2012 11:02 AM |
![]() |
mashtonsmith | Word | 1 | 03-11-2011 10:21 AM |