Re: Why must I click in document to force Word status bar to reset after running macros?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



G'day "Karen Walker" <terryandkaren@xxxxxxxxxxxxxx>,

Make a copy of the project. Strip out as much code as possible whilst
still duplicating the problem. Post the problem code. My first guess
would be to ensure all your exit points (ideally just one yeah) do a
Updating=True before handing back.

Also ensure you manually destroy objects

Set MyObject = Nothing


Steve Hudson - Word Heretic

steve from wordheretic.com (Email replies require payment)
Without prejudice


Karen Walker reckoned:

>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
>status bar to reset so the page number, etc. appears (status bar is blank
>until I click in the document).
>
>The code in the DLL is very careful to handle ScreenUpdating and StatusBar
>as it goes along, so I don't think the problem lies in how I am setting
>those. 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.
>
>Another strange thing is that after I have clicked in the document, if I
>then want to re-run the macro I 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 document window
>and my DLL app. What am I doing wrong and is there a good way to ensure the
>focus is being correctly set?
>
>Thanks
>k.
>

.



Relevant Pages

  • Re: Protecting against type mismatch errors
    ... The VBA project in the template that I will be distributing with the DLL is ... Or they might know too much and try to use, say, an Excel ... the macros, with minor/major tweaking will work with Excel. ...
    (microsoft.public.vb.general.discussion)
  • Re: Word Template in Startup folder loses dll references
    ... following dialogue box error message: "Compile error: Can't find project or ... Should copy all the macros into a new template, ... The DLL in question would be the basic one for VBA. ...
    (microsoft.public.word.vba.beginners)
  • Setting correct application focus when calling VB DLL from Word?
    ... I have several toolbar macros located in a Word 2003 global template. ... macros call a COM DLL to launch specific document templates with automation. ...
    (microsoft.public.office.developer.automation)
  • Why must I click in document to force Word status bar to reset after running macros?
    ... I have several toolbar macros located in a Word 2003 global template. ... macros call a COM DLL to launch specific document templates with automation. ...
    (microsoft.public.word.customization.menustoolbars)
  • Re: 2007 Normal Template
    ... template must be able to contain macros and such.) ... Document Template comes up with Normal). ... I want to start from scratch with the normal.dotx that word came with to set ... 2003 but it kept coming up with in the title bar so I ...
    (microsoft.public.word.docmanagement)