Waiting for Document to load

C

C_P

I am creating a word document that basically analyzes other word
documents that contain UAT test resuts (versus putting a button and
code on hundereds of documents). This should be done in VB.NET or
something along those lines, but licensing is an issue. My problem
lies when a document is opened up that takes a bit to load but the code
does not wait and executes before it is finished loading, giving
completely bogus results.
Here is the run down:

User selects which file to analyze using a dialog box, which
unfortunately does nothing else:

Application.Dialogs(wdDialogFileOpen).Show

<document starts to load>

<"freezes" document loading and executes code, giving bogus data>

<document finishes loading>

<user gets confused>

I would like a way to wait for the document to finish loading before
the analyzing code is executed.

Thanks!
 
C

C_P

NOTE: I have tried something like:

For i = 1 To 50
DoEvents
Next i

but because the CPU is doing virtually nothing, it has virutally no
affect
 
H

Helmut Weber

Hi,

see above: "How to test whether a document is fully loaded",
with a contribution from Jonathan West.

Other numerous samples to be found,
googling here for "ontime" and my decent name.

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 
C

C_P

Your help is greatly appreciated and it helped!
To bad google isn't better at picking things out because I searched all
yesturday on the groups!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top