Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
RKEvans RKEvans is offline
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Jay Freedman Jay Freedman is offline
external usenet poster
 
Posts: 9,854
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Ugnz Ugnz is offline
external usenet poster
 
Posts: 12
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Jay Freedman Jay Freedman is offline
external usenet poster
 
Posts: 9,854
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Ugnz Ugnz is offline
external usenet poster
 
Posts: 12
Default 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

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Dialog bolx opens behind Word 2002 zodder Microsoft Word Help 1 January 29th 08 12:59 AM
How can I start word so it opens the print dialog on startup? kevTheDev Microsoft Word Help 1 April 7th 07 01:05 AM
How can i create a macro button that opens a template? rob Microsoft Word Help 1 July 12th 05 12:24 AM
Macro that opens Outlook smcash Mailmerge 1 March 28th 05 09:05 PM
Create macro that changes the folder Word opens Ronni Backer Microsoft Word Help 2 February 10th 05 07:57 PM


All times are GMT +1. The time now is 01:05 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"