views:

177

answers:

2

I am looking for a way to programatically open the "New Document" dialog in Word 2007. It is the same one you get when you select File->New . You can also open it using the FileNew macro or the "New..." menu command. However, I have been unable to find a way to do this programmatically.

I have tried:

Application.Run MacroName:="FileNew"

and

Dialogs(wdDialogFileNew).Show

and

CommandBars.FindControl(ID:=5746).Execute

but both of these open the old dialog, not the new one that word 2007 uses.

A: 

I think that you can just use:

Documents.Add

without any parameters.

zdawg
no, that just adds a blank document
Otaku
+2  A: 

If a 'real' VBA command exists for open that dialog, I can't find it. However, I did find this utterly lame workaround via some quick googling:

SendKeys "%"
SendKeys "F"
SendKeys "N"

It does what you want though! Found it here http://www.eggheadcafe.com/software/aspnet/32228837/new-file-dialog-in-word-2.aspx

Nick
Thanks, I found that article too. Unfortunately, it creates that flicker as a result of the menu briefly coming up. I'm still considering it, but I was hoping to not to have to do this.
Jacob Adams
you can always turn the flicker on/off with Application.ScreenUpdating = True/False
Otaku
@Otaku Sadly, turning ScreenUpdating off doesn't help in this instance.
Nick
@Jacob Yeah, it is a bit annoying that there doesn't seem to be direct VBA access to that dialog. Just a hunch, but maybe there's a VSTO method to do this.
Nick