K
Karen Walker
I have several toolbar macros located in a Word 2003 global template. The
macros call a COM DLL to launch specific document templates with automation.
The VB6 DLL contains all the code and userforms to launch a new document
based on the template, present the user with a dialog box, etc.
After I run the main macro and return to the document, I sometime have to
click within the document for it to regain focus. This also causes the Word
document status bar to reset so the page number, etc. reappears (status bar
is blank until I click in the document).
The code in the DLL is very careful with Word's ScreenUpdating and StatusBar
as it goes along, so I don't think the problem lies there. (Also I have
tried using Doc.Activate at the last step of the main function in the DLL,
but it doesn't seem to have any effect in this scenario.)
After I have clicked in the document, if I then want to re-run the macro I
sometimes need to click twice on the Word toolbar button to run it (it's as
though the first click is activating the window containing the command bar).
Also when I next run the userform and click on a control, I may have to
click twice because the first click is apparently activating the form.
There seems to be a tug-of-war going on between the active Word window and
the DLL I am calling from within Word. What am I doing wrong and is there a
good way to ensure the focus is being correctly set?
Thanks
k.
macros call a COM DLL to launch specific document templates with automation.
The VB6 DLL contains all the code and userforms to launch a new document
based on the template, present the user with a dialog box, etc.
After I run the main macro and return to the document, I sometime have to
click within the document for it to regain focus. This also causes the Word
document status bar to reset so the page number, etc. reappears (status bar
is blank until I click in the document).
The code in the DLL is very careful with Word's ScreenUpdating and StatusBar
as it goes along, so I don't think the problem lies there. (Also I have
tried using Doc.Activate at the last step of the main function in the DLL,
but it doesn't seem to have any effect in this scenario.)
After I have clicked in the document, if I then want to re-run the macro I
sometimes need to click twice on the Word toolbar button to run it (it's as
though the first click is activating the window containing the command bar).
Also when I next run the userform and click on a control, I may have to
click twice because the first click is apparently activating the form.
There seems to be a tug-of-war going on between the active Word window and
the DLL I am calling from within Word. What am I doing wrong and is there a
good way to ensure the focus is being correctly set?
Thanks
k.