Or drop the variable completely...
If vbYes = MsgBox(Prompt:="Is this a font color?", Buttons:=vbYesNo + _
vbQuestion, Title:="Yes or No") Then
'do something
Else
'do something else
End If
--
Rick (MVP - Excel)
"Dave Peterson" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Or drop the boolean completely:
>
> Dim Answer as Long
> Answer = MsgBox(Prompt:="Is this a font color?", _
> buttons:=vbYesNo + vbQuestion, _
> title:="Yes or No")
>
> If Answer = vbYes Then
> 'do something
> else
> 'do something else
> end if
>
> Per Jessen wrote:
>>
>> Hi Steve
>>
>> I would not rely on the user to enter True or False, just use a msgbox to
>> answer yes or no, and then turn the answer to at boolean value:
>>
>> Dim MyVar As Boolean
>> Answer = MsgBox("Is this a font color?", vbYesNo + vbQuestion, "True or
>> False")
>> If Answer = vbYes Then MyVar = True
>> 'A boolean varieble is false by default
>>
>> Regards,
>> Per
>>
>> "Steve" <(E-Mail Removed)> skrev i meddelelsen
>> news:5B319A31-797F-4B99-940E-(E-Mail Removed)...
>> > Howdee all.
>> > I have a macro that I've got a variable that presently requires either
>> > a
>> > true, or false input.
>> > This macro calls to another function, which only requires an input if
>> > the
>> > element is true.
>> > I'd like it to only require an input if the statement is true.
>> >
>> > I just tried-
>> >
>> > MyVar = Application.InputBox(Prompt:="Is this a font color?- True or
>> > False",
>> > Type:=4)
>> >
>> > If MyVar= "" Then
>> > MyVar = False
>> > Else: MyVar = True
>> > End If
>> >
>> > I receive a type mismatch error when I do this.
>
> --
>
> Dave Peterson
|