Create a custom dialog box to automatically open with new documen.

A

ABW

I want to create a custom dialog box that will automatically open when a
certain document (Word) is opened, with a simple 'OK' button that will close
the box. I was able to create the dialog box with MS Visual Basic, but cant
figure out how to implement it into the document.
 
J

jim-means

Howdy! I'm trying to do something similar, but I'm a step behind you.

Being a little new to programming for Word, I'm trying to learn what VBA
commands are required to create the pop-up/dialog box in the first place.
I've been scrounging around the VBA help and on the net, but I'm obviously
not using the right search terms.

Any info you'd be willing to share on that will be greatly appreciated.
Thanks!
Jim
 
A

ABW

I have the message box macro working, but how do I get it to load
automatically when opening the document? Is there some code that gets run
when you first open a document that will run the macro up front?
 
A

ABW

Thanks Greg; still having a problem though...I can get this to work when I
add the macro event into the 'Normal.dot' template file. The purpose of this
specific dialog box, and this document, is fairly simple. This is a sample
document I am producing, and want to have a dialog box with a simple
disclaimer, and an OK button to unload the dialog box, when opening the
document. I then want to send this document out via email to other users
(hence the disclaimer), who will obviously not be working off the
'Normal.dot' template on my computer. I tried to copy the macro function from
the Normal.dot directly to the specific document, but it then will not run
properly when opening the document, even though the macro was working fine
when installed under the 'Normal.dot'. Please advise...I feel like I may be
overcomplicating this.
 
G

Greg Maxey

Did you put your code in the ThisDocument object? With your VBE open,
open the Project window. There should be a Project with the same name
as your document. Click the ThisDocument and put the Document_Open
code there.

It should run and display the msgbox when the document opens.

I will mention that sending documents that contain macros to people via
e-mail is likely to result in a lot of those documents being deleted
unread.
 
A

ABW

I dropped the security setting on my computer to 'medium', and the macro
worked...unfortunately that wont work for when I send it out to other
people...any additional suggestions? Is there any way to pop a diolog box
other than through macro?
 
J

jim-means via OfficeKB.com

You need to digitally sign the project, then instruct others to trust
documents with macros that come from you. Believe it or not, I actually
found the help provided with Word to be of use for this topic.

See the article called "Digitally sign a macro project" in Word help.

Jim in Pittsburgh

I dropped the security setting on my computer to 'medium', and the macro
worked...unfortunately that wont work for when I send it out to other
people...any additional suggestions? Is there any way to pop a diolog box
other than through macro?
Did you put your code in the ThisDocument object? With your VBE open,
open the Project window. There should be a Project with the same name
[quoted text clipped - 6 lines]
e-mail is likely to result in a lot of those documents being deleted
unread.
 
Top