Complex User Input Box

  • Thread starter Thread starter AndyGFLees
  • Start date Start date
A

AndyGFLees

Could someone please offer me an example of how I might achieve the
following Message/Input box in Excel and use the selections later on in
my macro:

Document Options

E-Mail Required Yes/No
E-Mail Address
Fax Required Yes/No
Fax Number
Printout Required Yes/No
Destination Printer \\example1\example1 on 1
\\example2\example2 on 2
\\example3\example3 on 3





Be kind - I am new to VBA and I am jumping straight in over my depth.
 
Hi Andy,
Could someone please offer me an example of how I might achieve the
following Message/Input box in Excel and use the selections later on in
my macro:

Document Options

E-Mail Required Yes/No
E-Mail Address
Fax Required Yes/No
Fax Number
Printout Required Yes/No
Destination Printer \\example1\example1 on 1
\\example2\example2 on 2
\\example3\example3 on 3


I think that a Userform would be a much better option.

Be kind - I am new to VBA and I am jumping straight in over my depth.

Debra Dalgleish has a very user-friendly tutorial at:

http://www.contextures.com/xlUserForm01.html

As you are new to VBA, you may wish to visit David McRitchie's 'Getting
Started With Macros And User Defined Functions' at:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

You might also look at David's tutorials page at:

http://www.mvps.org/dmcritchie/excel/excel.htm#tutorials

The VBA material is towards the bottom of the tutorials section.
 
Hello Andy,

Here is an example using both Message Boxes and Input Boxes in a macro
I wasn't quite sure want you were after for the Printer example, so
substituted an example of calling the Printer Dialog within Excel. Th
individual parts could be used as needed in your code when you need
response from the user. If you have any questions you can contact m
via private message here at the forum or email me (e-mail address removed)


EXAMPLE


Code
-------------------
Sub QueryTest()

Dim Email
Dim Fax
Dim RetVal

RetVal = MsgBox("Do you wish to send an Email?", vbQuestion + vbYesNo)
If RetVal = vbYes Then
Email = InputBox("Please Enter the Email address below.")
End If

RetVal = MsgBox("Do you want to send a Fax?", vbQuestion + vbYesNo)
If RetVal = vbYes Then
Fax = InputBox("Please enter the Fax number below.")
End If

RetVal = MsgBox("Do you want a Printout?", vbQuestion + vbYesNo)
If RetVal = vbYes Then
Excel.Application.Dialogs(xlDialogPrint).Show
End If

End Sub
 

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

Back
Top