Creating a macro to open a dialog box.

V

Vince

Using MS Word 2003

I would like to create a macro that opens a dialog box that prompts the user
to accept or deny certain terms.

The best example I can use is a EULA. Either you agree to the terms and the
document opens, or you disagree and document does not open.

Trying to figure this out alone is quite difficult, and any assistance
offered will be greatly appreciated.

Can anyone help me with this issue?
 
J

Jezebel

They are called UserForms in VBA. Add the form, put on it whatever controls
you need, write the code ...
 
V

Vince

Thanks for the input Jezebel!

Maybe I should be a bit more clear. I do not know VBA code; however, I do
know other languages and understand certain things.

I have created the project, added the userform to the correct document,
created the content, and started the buttons. I'm trying to figure out the
button contorls at the moment, and I was hoping that I wouldn't have to
manually type any code.

Maybe that's too much to desire... :)
 
J

Jonathan West

Vince said:
Thanks for the input Jezebel!

Maybe I should be a bit more clear. I do not know VBA code; however, I do
know other languages and understand certain things.

I have created the project, added the userform to the correct document,
created the content, and started the buttons. I'm trying to figure out the
button contorls at the moment, and I was hoping that I wouldn't have to
manually type any code.

Maybe that's too much to desire... :)


You will need to write some code.

If you're already familiar with other languages, these two articles ought to
get you up & running in VBA

Getting To Grips With VBA Basics In 15 Minutes
http://www.word.mvps.org/FAQs/MacrosVBA/VBABasicsIn15Mins.htm

How to create a Userform
http://www.word.mvps.org/FAQs/Userforms/CreateAUserForm.htm


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
 
V

Vince

Thank You very much Jonathan! The URLs were a great help!

With your help, I've learned to close the document via the Deny button, and
hide the form via the Accept button.

At this point, I've developed a template; however, I need to learn how to
run the macro during opening. This leads to another issue. When I open the
template and run the macro, the userform is not displayed. Running the macro
from the VB Editor does display the form, but only if the form window is
active. Seems strange to me, but I am still working on it.

Once again, Thanks for the assistance.
 
J

Jonathan West

Vince said:
Thank You very much Jonathan! The URLs were a great help!

With your help, I've learned to close the document via the Deny button,
and
hide the form via the Accept button.

At this point, I've developed a template; however, I need to learn how to
run the macro during opening. This leads to another issue. When I open the
template and run the macro, the userform is not displayed. Running the
macro
from the VB Editor does display the form, but only if the form window is
active. Seems strange to me, but I am still working on it.

Once again, Thanks for the assistance.

Hi Vince

You can run the form from a macro by doing something like this

Sub RunMyForm()
frmMyForm.Show
End Sub

If you want the form to show when you create a new document based on the
template, call the macro AutoNew instead of RunMyForm. If you want the form
to show every timke you open a document based on the template, call the
macro AutoOpen.

--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
 

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