MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Message box with user input

  Asked By: Kaua    Date: Dec 02    Category: MS Office    Views: 1790

What type of message box/ input box can I use to have a message pop up
for the user wherein the user can select one of two default options
available. (such as in a option box ie. with radio buttons)
Based on the value of the selction, I would like to use a condinoal
IF/Then Statement or a Select Case statement to execute appropriate



5 Answers Found

Answer #1    Answered By: Louis Mason     Answered On: Dec 02

Why not just create a User Form?! Put what ever you want on the form,
radio buttons, check boxes, etc. and build your code from there.

Answer #2    Answered By: Hehet Chalthoum     Answered On: Dec 02

I thought of that before, however I alreday have a user  form and I
wanted to avoid keeping this input  from the user on that form and
have a seperate user input via a message  box or input box.

Answer #3    Answered By: Sean Grant     Answered On: Dec 02

Once again, and I'm only making an observation here, since you want to
call upon an input  style control, why not create a second user  form?!
Design the form to look similar to the input box  control, but add the
check boxes, or other controls you want for the user. The point is if
you're planning on calling up a control at one point within your code,
why not replace it with a user form designed with the programming logic,
look, and feel that you prefer?

Answer #4    Answered By: Huette Miller     Answered On: Dec 02

I took your suggestion and created a new user  form. Howveer, I ma
getting a compiler error now.
Here is what I did.

I have a simple form with a two option  buttons op1 and op2. Selecting
> op1 should execute  the following lines of code however, I am
getting an error Object variable or With block variable not set error.
> Do I need to declare any other variab;e/ form to avoid this.?
> Private Sub CommandButton1_Click()
> Dim plate As Boolean
> Load frm
> frm.Show
> plate = frm.op1.Value
> If plate = True Then
> LookAhead = 110
> Else
> LookAhead = 93
> End If
> End Sub
The line plate = frm.op1.Value is generating the error. I think it is
not correctly assigning the option box  value ie "True/False" to the
boolean variable plate.
Any inputs?

Answer #5    Answered By: Maria Miller     Answered On: Dec 02

That's because the option  button is not returning a true false value. It
actually returns a zero (0) or a negative one (-1) depending on if it is
clicked or not. Change your dimension for plate to long and change your
IF statement  to look for a -1 or not.

Dim plate as Long

Didn't find what you were looking for? Find more on Message box with user input Or get search suggestion and latest updates.