> Dim myAnswer as String
This is incorrect. You should use
Dim myAnswer as Long
or, better (in Excel 2000 and later),
Dim myAnswer As VbMsgBoxResult
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
www.cpearson.com
(email address is on the web site)
"ChadF" <(E-Mail Removed)> wrote in message
news:B9B0A7A5-A19B-4812-B4DC-(E-Mail Removed)...
>
> Hello,
>
> You might want to consider this approach:
>
> Dim myAnswer as String
>
> myAnswer = MsgBox "Do you want to Save", vbYesNo
>
> if myAnswer = vbYes then
> .... 'do something
> else
> ... ' do something else ...
> end if
>
> There are several options you can do with MsgBox.
>
> Hope this helps,
> Chad
>
>
> "isbjornen" wrote:
>
>> Hello,
>>
>> I have a question on how to answer message boxes programmatically.
>> For example: Answering [No] when closing a file and the message box
>> prompts
>> me to save.
>> I've programmed in Lotus before and I used this command:
>> AnswerMsgBox (Value)
>>
>> The command had to be entered on the line preceding the message box
>> AnswerMsgBox No
>> Application.Quit
>> In this example the program does not prompt to save before closing.
>>
>> Is there a similar command in Excel?
>>
>> Thanx!