Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
How to Create a Macro that opens a Dialog Box
Help. Through user error I managed to wipe out all of my macros this
mornings. I have been able to recreate most of them, but I am having some trouble with what should probably be the simplest one and I originally created it so long ago that I cannot remember how I did it. All I want the marco to do is open the Page Setup dialog box. I am recording the macro as a button on the tool bar and I am using the following key strokes: Alt, File, Page Setup. This is where the problem occurs. Because the Page Setup dialog box is open and active, I cannot press the 'Stop Recording' button. If I close the dialog box that action is included in the macro therefore defeating the purpose of the macro. I've tried editing the macro, but can't seem to get that right either. All suggestions welcome. Thanks! |
#2
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
How to Create a Macro that opens a Dialog Box
RKEvans wrote:
Help. Through user error I managed to wipe out all of my macros this mornings. I have been able to recreate most of them, but I am having some trouble with what should probably be the simplest one and I originally created it so long ago that I cannot remember how I did it. All I want the marco to do is open the Page Setup dialog box. I am recording the macro as a button on the tool bar and I am using the following key strokes: Alt, File, Page Setup. This is where the problem occurs. Because the Page Setup dialog box is open and active, I cannot press the 'Stop Recording' button. If I close the dialog box that action is included in the macro therefore defeating the purpose of the macro. I've tried editing the macro, but can't seem to get that right either. All suggestions welcome. Thanks! This will do it: Sub PageSetupDialog Dialogs(wdDialogFilePageSetup).Show End Sub -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. |
#3
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
How to Create a Macro that opens a Dialog Box
My question is, how do you find out what the dialog box is called. I've seen
this question twice now, for different dialog boxes, and I don't want to have to ask every time I want to write a macro for a new dialog box. I've tried, and unfortunately wild guessing doesn't do the trick Thanks "Jay Freedman" wrote: RKEvans wrote: Help. Through user error I managed to wipe out all of my macros this mornings. I have been able to recreate most of them, but I am having some trouble with what should probably be the simplest one and I originally created it so long ago that I cannot remember how I did it. All I want the marco to do is open the Page Setup dialog box. I am recording the macro as a button on the tool bar and I am using the following key strokes: Alt, File, Page Setup. This is where the problem occurs. Because the Page Setup dialog box is open and active, I cannot press the 'Stop Recording' button. If I close the dialog box that action is included in the macro therefore defeating the purpose of the macro. I've tried editing the macro, but can't seem to get that right either. All suggestions welcome. Thanks! This will do it: Sub PageSetupDialog Dialogs(wdDialogFilePageSetup).Show End Sub -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. |
#4
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
How to Create a Macro that opens a Dialog Box
There are several ways to approach this:
- In the VBA editor, click View Object Browser (or the shortcut, F2). In the search box (to the left of the binoculars icon), type wdDialog and press Enter. This will give you a list of all the members of the WdWordDialog enumeration, which you can scroll through, looking for a likely match. Or search on the term that appears in the title bar of the dialog when you display it from the menu -- for example, searching on "setup" will find wdDialogFilePageSetup and wdDialogFilePrintSetup. - In the VBA help, look at the topic "Built-In Dialog Box Argument Lists". Besides listing all the WdWordDialog values, this table also shows the names of the arguments you can set or retrieve. Unfortunately, it doesn't tell you the data types or meanings of the arguments. Read http://www.word.mvps.org/FAQs/MacrosVBA/WordDlgHelp.htm for help with that job. - Put together the name of the menu (in Word 2003 or earlier) and the menu item that you would click to open the dialog, and stick "wdDialog" in front of it. Then look for that name in either of the first two lists -- if you find it there, you probably have the right name (try it!). On Mon, 22 Sep 2008 15:41:00 -0700, Ugnz wrote: My question is, how do you find out what the dialog box is called. I've seen this question twice now, for different dialog boxes, and I don't want to have to ask every time I want to write a macro for a new dialog box. I've tried, and unfortunately wild guessing doesn't do the trick Thanks "Jay Freedman" wrote: RKEvans wrote: Help. Through user error I managed to wipe out all of my macros this mornings. I have been able to recreate most of them, but I am having some trouble with what should probably be the simplest one and I originally created it so long ago that I cannot remember how I did it. All I want the marco to do is open the Page Setup dialog box. I am recording the macro as a button on the tool bar and I am using the following key strokes: Alt, File, Page Setup. This is where the problem occurs. Because the Page Setup dialog box is open and active, I cannot press the 'Stop Recording' button. If I close the dialog box that action is included in the macro therefore defeating the purpose of the macro. I've tried editing the macro, but can't seem to get that right either. All suggestions welcome. Thanks! This will do it: Sub PageSetupDialog Dialogs(wdDialogFilePageSetup).Show End Sub -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. |
#5
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
How to Create a Macro that opens a Dialog Box
You beauty!!
I shall be using this a lot Thanks heaps, Jay. Maria "Jay Freedman" wrote: There are several ways to approach this: - In the VBA editor, click View Object Browser (or the shortcut, F2). In the search box (to the left of the binoculars icon), type wdDialog and press Enter. This will give you a list of all the members of the WdWordDialog enumeration, which you can scroll through, looking for a likely match. Or search on the term that appears in the title bar of the dialog when you display it from the menu -- for example, searching on "setup" will find wdDialogFilePageSetup and wdDialogFilePrintSetup. - In the VBA help, look at the topic "Built-In Dialog Box Argument Lists". Besides listing all the WdWordDialog values, this table also shows the names of the arguments you can set or retrieve. Unfortunately, it doesn't tell you the data types or meanings of the arguments. Read http://www.word.mvps.org/FAQs/MacrosVBA/WordDlgHelp.htm for help with that job. - Put together the name of the menu (in Word 2003 or earlier) and the menu item that you would click to open the dialog, and stick "wdDialog" in front of it. Then look for that name in either of the first two lists -- if you find it there, you probably have the right name (try it!). On Mon, 22 Sep 2008 15:41:00 -0700, Ugnz wrote: My question is, how do you find out what the dialog box is called. I've seen this question twice now, for different dialog boxes, and I don't want to have to ask every time I want to write a macro for a new dialog box. I've tried, and unfortunately wild guessing doesn't do the trick Thanks "Jay Freedman" wrote: RKEvans wrote: Help. Through user error I managed to wipe out all of my macros this mornings. I have been able to recreate most of them, but I am having some trouble with what should probably be the simplest one and I originally created it so long ago that I cannot remember how I did it. All I want the marco to do is open the Page Setup dialog box. I am recording the macro as a button on the tool bar and I am using the following key strokes: Alt, File, Page Setup. This is where the problem occurs. Because the Page Setup dialog box is open and active, I cannot press the 'Stop Recording' button. If I close the dialog box that action is included in the macro therefore defeating the purpose of the macro. I've tried editing the macro, but can't seem to get that right either. All suggestions welcome. Thanks! This will do it: Sub PageSetupDialog Dialogs(wdDialogFilePageSetup).Show End Sub -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Dialog bolx opens behind Word 2002 | Microsoft Word Help | |||
How can I start word so it opens the print dialog on startup? | Microsoft Word Help | |||
How can i create a macro button that opens a template? | Microsoft Word Help | |||
Macro that opens Outlook | Mailmerge | |||
Create macro that changes the folder Word opens | Microsoft Word Help |