markh1182
11-28-2007, 09:31 AM
Hi, I have some code that creates an index for a document based on a list in another document. Therefore it goes through and adds the automarkup code to all the relevant references.
Code:
ActiveDocument.AttachedTemplate.AutoTextEntries("_CVSector").Insert where:= _
Selection.Range, RichText:=True
ActiveWindow.ActivePane.View.ShowAll = True
ActiveDocument.Indexes.AutoMarkEntries ConcordanceFileName:= _
"C:\abc32\Office2K\Documents\CV Register\CVRegAutoTextSectors.doc"
ActiveWindow.ActivePane.View.ShowAll = False
Therefore, when this runs through adding the automarkup code, the pages increase in the document to around 350, once I switch the activepane.view.showall = false, the page count should go down to about 300 pages.
However, in this instance I have to wait for Word to refresh or even click in the document and wait for the page count to go down, before refreshing the index to get the correct page numbers.
Does anyone know if you can refresh Word through code, or maybe delay so Word might have a chance to catch up and refresh the page count?
Thanks, Mark
Code:
ActiveDocument.AttachedTemplate.AutoTextEntries("_CVSector").Insert where:= _
Selection.Range, RichText:=True
ActiveWindow.ActivePane.View.ShowAll = True
ActiveDocument.Indexes.AutoMarkEntries ConcordanceFileName:= _
"C:\abc32\Office2K\Documents\CV Register\CVRegAutoTextSectors.doc"
ActiveWindow.ActivePane.View.ShowAll = False
Therefore, when this runs through adding the automarkup code, the pages increase in the document to around 350, once I switch the activepane.view.showall = false, the page count should go down to about 300 pages.
However, in this instance I have to wait for Word to refresh or even click in the document and wait for the page count to go down, before refreshing the index to get the correct page numbers.
Does anyone know if you can refresh Word through code, or maybe delay so Word might have a chance to catch up and refresh the page count?
Thanks, Mark