WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

OLE with Word

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Wait for Document to Load Completely

 Keywords: Wait Document File Load Completely Complete Done Repaginate Open Method

; This code gets the number of tick counts is takes to load a file into Word.
; Trick: uses repaginate method to wait for document to load completely.
file=  "D:\Manuals\WIL\Qwil.docx"

starttick = GetTickCount()

oWORD  = ObjectCreate("Word.Application")
oWORD.visible=@TRUE
oDOCS = oWORD.Documents.Open(file)
oActiveDoc = oWORD.activedocument
oActiveDoc.Repaginate() ; Trick to wait for page to load completely

endtick = GetTickCount()

Pause('Tickcount time to load doc', endtick-starttick)

oActiveDoc.close()
oSel = 0
oActiveDoc = 0
oDOC = 0

oWORD.Quit
oWORD = 0
Exit

Article ID:   W18152
Filename:   Wait for Document to Load Completely.txt
File Created: 2010:07:29:11:45:46
Last Updated: 2010:07:29:11:45:46