PDA

Click to See Complete Forum and Search --> : Slow code/pauzed code when word subwindow is open


lvermeersch
Jan 6th, 2006, 11:54 AM
I use Word Automation in my VB6 application
When Word doc is open and i open a word Subwindow (like textbox properties
or options window) the vb6 code pauzes especially in WInME, it does allso in
WinXP but less freguently.
Because of the pauze,
some of my codeevents (expl mouseup event) gets in very late after 5 seconds and because the code is pauzed, this gives an error
'An action can not be completed because a component (document1 - word) is
busy. This screen has buttons ABort Retry Ignore.

Is there maybe an adjustment in a proces (to influence the word/windows
behavior) i can set so the vb code always continiues allso when Word
subwindow is open.
Many thx

si_the_geek
Jan 6th, 2006, 02:58 PM
That is certainly understandable, Word will take care of itself before dealing with client applications (your VB6 program). I presume that you have a different version of Word on each PC, hence the difference in speed (either that or the efficiency of XP is showing).

As you seem to be working with the UI of Word, is there a reason to be using VB6 instead of VBA inside Word? It should be much more responsive, as the events are raised internally rather than externally.

lvermeersch
Jan 7th, 2006, 02:15 AM
Well the reason i use vb6 rather then VBA, i don't want to mess with the doc itself, otherwise user can disable the vba, you have design and run mode i don' like, and you have the security issues, i wouldn't recommend using vba for that reason, i did use vba in the past... event capturing does seem a problem in VB6 at first but gonna overcome that.
Now when i can make the COmponent busy window invisible this would be great because as soon as user closes the subwindow the code is continued normally.

si_the_geek
Jan 7th, 2006, 12:01 PM
Unfortunately the "Component busy" window blocks your program, so I don't think you can do anything about it.

What you could do however is something like what I have done before for Excel, although I don't know how well it would work for Word due to the difference in document formats.

What I did was to have code in the Close event that hid the document (basically hiding all worksheets with data, and showing one which said "must have macros enabled"), which was undone when the open even fired.

Unfortunately in Word you can't really do this, as everything is in a single document - what you may be able to do is lock the document for editing, and then unlock/lock the document for editing as part of your VBA code (perhaps on the open/close events).