PDA

View Full Version : Refresh Word to Update Pages



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

TonyJollans
11-28-2007, 10:11 AM
Background repagination can be quite a slow process. Is there a reason you need ShowAll to start with?

markh1182
11-29-2007, 09:23 AM
I thought that was what was required to insert the automarkup entries. Is this not the case?

markh1182
11-29-2007, 09:54 AM
just tried without the showall option and this is still working. I will try this on the user machine and see if this helps.

Thanks for your help.