none
Word 2007 Macro - Accessing My Templates via Word command? RRS feed

  • Question

  • Ok, so I've found that I can actually select Macros in Word 2007 and select Word commands. I can also run these commands using

    Application.Run MacroName:="FileNewDialog"

     

    But, there's also a command in File New that allows me to select "My Templates", which opens a similar dialog, but only my own templates and not the default ones provided with Microsoft. I don't want those at all, makes the dialog view all cluttery. Does anyone know the command to open this specific dialog box?


    • Edited by Kenny Bones Wednesday, August 17, 2011 12:37 PM
    Wednesday, August 17, 2011 8:56 AM

Answers

  • Hi Kenny

    No, in that case there won't be a "simple" way to programmatically obtain what you want.

    A possibility, if this is for your own private use, would be to try using SendKeys to emulate what you'd do with the keyboard as an end-user to get where you want to go. SendKeys isn't terribly reliable, but is usually "good enough" for a private tool.

    I find I can press TAB a couple of times, then down-arrow a couple of times in the 2007 "New" dialog box, for example, to get to "My templates".

    The only other solution would be to create your own dialog box (user form) that lists the templates from the directory in question.


    Cindy Meister, VSTO/Word MVP
    • Marked as answer by Bruce Song Thursday, September 1, 2011 7:51 AM
    Thursday, August 18, 2011 12:49 PM
    Moderator

All replies

  • Hi Kenny,

    Do you mean this one?

      With Dialogs(wdDialogFileNew)
        .Show
      End With
    
    

     


    Kind Regards, Rich ... http://greatcirclelearning.com
    Wednesday, August 17, 2011 10:48 AM
  • I'm not sure, are you talking about Visual Studio? I'm just talking about Word macros, in Word directly.
    I can create a macro and just write:
    Application.Run MacroName:="FileNewDialog"

    And when that macro is run, the dialog window appear. I want it to display My Templates only, instead of the default ones and my own mixed together. It should be possible because if I open Word 2007 and go to New, I can select "My templates" and a very similar dialog window appear with just my templates and not the default ones mixed together.

     

    Wednesday, August 17, 2011 12:40 PM
  • Hi Kenny

    No, Rich is talking VBA, and it's what I would have suggested...


    Cindy Meister, VSTO/Word MVP
    Wednesday, August 17, 2011 4:34 PM
    Moderator
  • Ok I see. Just didn't recognize the code. But it basically does the exact same thing as the line I posted above. Meaning, what I'm asking is probably not possible.
    Thursday, August 18, 2011 5:53 AM
  • Hi Kenny

    No, in that case there won't be a "simple" way to programmatically obtain what you want.

    A possibility, if this is for your own private use, would be to try using SendKeys to emulate what you'd do with the keyboard as an end-user to get where you want to go. SendKeys isn't terribly reliable, but is usually "good enough" for a private tool.

    I find I can press TAB a couple of times, then down-arrow a couple of times in the 2007 "New" dialog box, for example, to get to "My templates".

    The only other solution would be to create your own dialog box (user form) that lists the templates from the directory in question.


    Cindy Meister, VSTO/Word MVP
    • Marked as answer by Bruce Song Thursday, September 1, 2011 7:51 AM
    Thursday, August 18, 2011 12:49 PM
    Moderator