replacing Windows File System Dialog with our own custom dialog

A

Ashishthaps

is there an API function or hook that would allow us to replace the Windows
File System Dialog with our own custom dialog when selecting the Open
Original Document or Revised Document actions in Word 2007?
 
J

Jay Freedman

is there an API function or hook that would allow us to replace the Windows
File System Dialog with our own custom dialog when selecting the Open
Original Document or Revised Document actions in Word 2007?

Big Idea #1: The New and Open dialogs in Word are _not_ from the Windows file
system. They're strictly part of Office. That means you don't need (and can't
use) API functions to work with them or replace them.

Big Idea #2: You can intercept user actions simply by writing macros whose names
are the same as the commands they intercept, in this case FileNew and FileOpen.
The macros run when the user issues the corresponding command, whether by menu
item (on the Office button in Office 2007), by Quick Access Toolbar button, or
by keyboard shortcut. The macros can do anything you program them to do,
including displaying a custom dialog. It's a good idea to have the macro execute
code to perform the original action (e.g., Documents.Add in the FileNew macro),
but that isn't strictly necessary. More details at
http://www.word.mvps.org/FAQs/MacrosVBA/InterceptSavePrint.htm.

Big Idea #3: Office VBA enables you to design/write custom dialogs as UserForms.
These are similar to, but not interchangeable with, forms from VB. You can
certainly create a UserForm that does some, all, or more than the work done by
the built-in dialog, but you'll have to build it from scratch
(http://www.word.mvps.org/FAQs/Userforms/CreateAUserForm.htm). An alternative
that may work for you, if you don't need extra controls in the dialog, is to
display the standard dialog and then do extra processing of the returned user
information before ending the macro
(http://www.word.mvps.org/FAQs/MacrosVBA/WordDlgHelp.htm).
 
A

Ashishthaps

Thanks Jay,

I have a question on #3. We looked at calling the Compare dialog with VBA,
but was unable to find a wdDialog corresponding to the Compare dialog. Can
you tell us what the VBA name of that dialog is?
 
A

Ashishthaps

Thanks Jay,

I have a question on #3. We looked at the approach of calling the Compare
dialog with VBA, but was unable to find a wdDialog corresponding to the
Compare dialog. Can you tell uswhat the VBA name of that dialog is?
 
G

Greg Maxey

Thanks Jay,

I have a question on #3. We looked at calling the Compare dialog with VBA,
but was unable to find a wdDialog corresponding to the Compare dialog. Can
you tell us what the VBA name of that dialog is?

Try

Dialogs(198).Show
 
J

Jay Freedman

Try

Dialogs(198).Show

Or, using the named enumeration, wdDialogToolsCompareDocuments (whose value is
198).

For backward compatibility, the names of these evaluations are based on where
the command was shown in the menu system of Word 2003 and earlier; the Compare
Documents command was in the Tools menu.

To find these in the VBA editor, open the Object Browser (F2) and enter part of
the name (e.g., "compare") in the search box. It will show every class member
whose name includes that fragment.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top