Trigger the Properties Dialog box on open

J

Jack_Feeman

This is slightly different than some of the other questions on the group.

We are developing a template for drafting over 2000 instruction documents.
Since most of our user base have never correctly used templates and we want
the flow to be as smooth as possible; we are putting as much repetitive
information into properties as we can.

Of course, we will instruct them on our to use the template; but judging
from past experience.... We thought if we opened the properties dialog box
for them when they opened the template it would increase our odds that they
will use it.

Our problem is that while recording the macro, we have to close the dialog
box before stopping the recorder and then it has nothing written to it when
we do.

How can we automatically open the Properties dialog box when a user opens
the template?

Thanks
 
J

Jay Freedman

Put the following maro into a regular module of the template:

Sub AutoNew()
Const wdDialogFileProperties = 750
On Error Resume Next ' in case of Cancel
Dialogs(wdDialogFileProperties).Show
End Sub

If you want the dialog to open also when an existing document based on the
same template is opened, make another copy of the macro in the same module
and change its name to AutoOpen.

The constant declaration is needed because, for reasons I never understood,
Microsoft didn't define a built-in constant to represent the File >
Properties dialog. There is one for wdDialogFileSummaryInfo, which is a
useless cut-down version. <shrug>

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
J

Jean-Guy Marcil

Jack_Feeman was telling us:
Jack_Feeman nous racontait que :
This is slightly different than some of the other questions on the
group.

We are developing a template for drafting over 2000 instruction
documents. Since most of our user base have never correctly used
templates and we want the flow to be as smooth as possible; we are
putting as much repetitive information into properties as we can.

Of course, we will instruct them on our to use the template; but
judging from past experience.... We thought if we opened the
properties dialog box for them when they opened the template it would
increase our odds that they will use it.

Our problem is that while recording the macro, we have to close the
dialog box before stopping the recorder and then it has nothing
written to it when we do.

How can we automatically open the Properties dialog box when a user
opens the template?

I think you meant to ask how to activate that dialog when creating a
document form the template, not when opening the template itself.
This particular dialog is not part of the Dialogs collection... go figure!

So you need a workaround.
Also, when displaying the dialog through VBA, if the user hits "Cancel" you
get an annoying error message. This is why I sorta trap the error in the
code below.

Paste this code in the ThisDocument module of your template. IF you want the
dialog only when creating a document (Not when subsequently opening it, do
not use the Document_Open.

'_______________________________________
Private Sub Document_New()

On Error Resume Next
WordBasic.FileProperties
On Error GoTo 0

End Sub
'_______________________________________

'_______________________________________
Private Sub Document_Open()

On Error Resume Next
WordBasic.FileProperties
On Error GoTo 0

End Sub
'_______________________________________

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
J

Jack_Feeman

Thanks for the great responses and for your insights as well. Yes, only
opening the dialog box on the creation of a new document from the template is
a great way to do this.

Thanks again, Jack
 

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