
Signature
Chuck Henrich
www.ProductivityApps.com
Hi Chuck,
I am still not able to track any information. I will once again explain you
in detail what i want. When I click File-> Page Setup menu item a Page setup
dialog box opens. Now when we click OK, then I want to get which orientation
was selected by the user and then depending on the same i have to do some
changes. so i am not able to get the orientation details after the OK button
is clicked. I think I have clarified my issue to you.
GS
> If you open Word, drill down through the Tools menu to Macro > Visual Basic
> Editor and then use Help in the Visual Basic Editor (VBE) you'll find the
[quoted text clipped - 22 lines]
> > > >
> > > > GS
Chuck Henrich - 16 Aug 2005 12:12 GMT
You really need to take the time to read through the VBE help on Dialogs as
well as related links (especially "Displaying built-in Word dialog boxes" and
"Built-in dialog box argument lists"). All the information you need is
there. I'm assuming that as a developer you have Word installed and that
you installed the VBA help files.
In a nutshell, you "display" the dialog (if you want to collect information
but not execute the dialog settings) or "show" the dialog (if you want to
collect information and then execute the settings) and then use a built in
argument to return a value from the dialog.
For instance, adapting an example from the VBE help topic "Displaying
built-in Word dialog boxes":
With Dialogs(wdDialogFilePageSetup)
.Display
MsgBox .Orientation
End With
will display the Page Setup dialog; when the user clicks OK a message box
shows the numeric constant value of the .Orientation setting but because the
dialog was "displayed" the change isn't made to the .Orientation setting.
For information on how to get numeric constant values see the MS
KnowledgeBase article 239930 "How To Obtain Built-In Constant Values for an
Office Application"
(http://support.microsoft.com/default.aspx?scid=kb;en-us;239930).
HTH

Signature
Chuck Henrich
www.ProductivityApps.com
> Hi Chuck,
>
[quoted text clipped - 33 lines]
> > > > >
> > > > > GS
Praful - 17 Aug 2005 09:26 GMT
Hi,
Thanks a lot for the help.
I have one more question and want your help. Is it possible that we somehow
restrict word to add entries in Undo stack or is it possible that we make a
set of events act as one Undo event.
GS
> You really need to take the time to read through the VBE help on Dialogs as
> well as related links (especially "Displaying built-in Word dialog boxes" and
[quoted text clipped - 62 lines]
> > > > > >
> > > > > > GS
Chuck Henrich - 17 Aug 2005 11:10 GMT
You're welcome for the help.
As for the undo question, I don't believe you can pick and choose which
event to undo from the stack. You should start another thread for this
question because someone else may have an idea.

Signature
Chuck Henrich
www.ProductivityApps.com
> Hi,
>
[quoted text clipped - 72 lines]
> > > > > > >
> > > > > > > GS
Praful - 17 Aug 2005 11:58 GMT
Me back again.......
Just a small issue left. I am calling a PageSetup dialog box on Page Setup
click only and then i am even able to take the return type (thanks for the
path you shown me). But i am getting one issue that Word is also opening the
PageSetup window once I close mine. Is it possible that the Window that Word
launches is not shown and the total function is overriden by my function.
GS
> You're welcome for the help.
>
[quoted text clipped - 78 lines]
> > > > > > > >
> > > > > > > > GS
Chuck Henrich - 17 Aug 2005 12:01 GMT
Could you post your function code?

Signature
Chuck Henrich
www.ProductivityApps.com
> Me back again.......
> Just a small issue left. I am calling a PageSetup dialog box on Page Setup
[quoted text clipped - 87 lines]
> > > > > > > > >
> > > > > > > > > GS
Praful - 17 Aug 2005 12:05 GMT
Dim dlgPgSetup As Microsoft.Office.Interop.Word.Dialog
Dim retval As Long
dlgPgSetup = AppObj.Dialogs(WdWordDialog.wdDialogFilePageSetup)
retval = dlgPgSetup.Show
If retval = -1 Then
If CheckCLI() = False Then 'CheckCLI is my function
Exit Sub
Else
ClassificationBox(0) ' ClassificationBox is my
function
End If
End If
> Could you post your function code?
>
[quoted text clipped - 89 lines]
> > > > > > > > > >
> > > > > > > > > > GS
Chuck Henrich - 17 Aug 2005 12:16 GMT
The problem may be that your code is showing the dialog after the user has
already clicked PageSetup. If you're trapping the PageSetup click event then
you don't need to show the dialog again.
You could set the CancelDefault argument of the PageSetup Click event to
True to prevent the built in command from executing. Then your code can show
the dialog and deal with the return value etc.

Signature
Chuck Henrich
www.ProductivityApps.com
> Dim dlgPgSetup As Microsoft.Office.Interop.Word.Dialog
> Dim retval As Long
[quoted text clipped - 102 lines]
> > > > > > > > > > >
> > > > > > > > > > > GS
Praful - 17 Aug 2005 12:24 GMT
I have tried the CancelDefault = true but the same problem persists. This is
the issue. Is it possible that I get a return type from the dialog box that
is opened by Word itself. Then the problem for me will be solved as i will
not be opening a new dialog box and thus trapping the word's dialog will
solve my problem.
GS
> The problem may be that your code is showing the dialog after the user has
> already clicked PageSetup. If you're trapping the PageSetup click event then
[quoted text clipped - 110 lines]
> > > > > > > > > > > >
> > > > > > > > > > > > GS
Chuck Henrich - 17 Aug 2005 12:39 GMT
As far as I'm aware, you can only return values from dialog boxes that are
objects in your code - otherwise, how would your code know what they are?
You'll have to explore why CancelDefault isn't working for you and I don't
have any ideas on that score. Sorry.

Signature
Chuck Henrich
www.ProductivityApps.com
> I have tried the CancelDefault = true but the same problem persists. This is
> the issue. Is it possible that I get a return type from the dialog box that
[quoted text clipped - 118 lines]
> > > > > > > > > > > > >
> > > > > > > > > > > > > GS