Results 1 to 2 of 2
2004-05-17, 20:14 #1
- Join Date
- May 2003
- Los Angeles, California, USA
- Thanked 2 Times in 2 Posts
Settings for recording macros (Word 2002 SP-2)
As noted in my post from yesterday, I have a homemade dialog that I use to select Word macros for running and editing.
I'd love to be able to use it to record macros as well. That is, it would be great if, when I typed the new macro's name in the text box and hit the Record button (i.e., the Record button in my dialog), Word would do the following:
1. Open my global macros template, if it isn't already. (Like most of us, I believe, I'm putting my macros in their own separate template.)
2. Change the location for the recorded macro to the global macros template.
3. Start recording the macro with the already-active document (not the macros template) as the active document.
VBA can certainly handle Step 1, but how about Steps 2 & 3? (If the answer is "SendKeys," please don't tell me about it unless you have personal glitch-free experience using SendKeys for this purpose.)
Alternatively, is there a setting I can tweak (Registry or otherwise) to handle Step 2?
2004-05-17, 20:36 #2
- Join Date
- Feb 2001
- Silicon Valley, USA
- Thanked 94 Times in 90 Posts
Re: Settings for recording macros (Word 2002 SP-2)
Regarding Nos. 2-3, the online help for Word 2002 VBA, Built-in Dialog Box Argument Lists, says:
wdDialogToolsMacroRecord (This dialog box cannot be called from a macro.)
(A macro that "clicks" the menu choice using CommandBars.FindControl(ID:=2780).Execute also returns an error.)
This suggests that you might have to implement any macro recording feature using a separate program (e.g., COM Add-in) rather than a standard macro.
After you turn off recording to the (currently non-global) macros template, you'll have to clear out the code for switching back to the previously active document.