PDA

View Full Version : Message box with options



JZB
08-25-2009, 08:42 AM
Hi Guys

I want to create a message box at the start of the macro where the user can pick the variable from a list.

The option picked then becomes my variable.

I not sure how to do this.

I know input box is an option but would rather restrict the useer to finite options

Any help would be appreciated

Thanks

Jon

Mavyak
08-25-2009, 09:39 AM
Create a form that looks like an "input box" form but has a combobox on it instead.

mikerickson
08-25-2009, 10:35 AM
You could use an input box like this

InputPrompt = "Enter the appropriate number" & vbCr
InputPrompt = InputPrompt & "1 - first thing" & vbCr
InputPrompt = InputPrompt & "2 - second thing" & vbCr
'...
InputPrompt = InputPrompt & "N - last thing" & vbCr

Do
uiChoice = Application.InputBox(InputPrompt, default= "1", type:=1)
If uiChoice = 0 the Cancel
Loop until 0 < uiChoice And uiChoice <= N

Select Case uiChoice
Case Is = 1
'...
End Select
If you go with the userform approach, you should consider building it around a list box.