i would like to place a simple yes no msg box, have tried the code i
thought worked, but not having much success,
simply want a yes no button with message,
Yes msg box closes, no file saves and closes.
Any help??????
Martin Fishlock - 21 Dec 2006 00:13 GMT
Hi Kikk ka
Try this:
sub askmsg()
if msgbox("Some message", vbYesNo)=vbNo then
activeworkbook.close true
end if
end sub

Signature
Hope this helps
Martin Fishlock, Bangkok, Thailand
Please do not forget to rate this reply.
> i would like to place a simple yes no msg box, have tried the code i
> thought worked, but not having much success,
[quoted text clipped - 4 lines]
>
> Any help??????
Alan - 21 Dec 2006 00:25 GMT
Sub Update()
Dim Msg, Style, Title, Response
Title = "Your Message?"
Msg = "Click 'Yes' to close this message, 'No' to save the file and close "
Style = vbYesNo + vbQuestion
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then Exit Sub
ThisWorkbook.Save
ThisWorkbook.Close
End Sub
Regards,
Alan
>i would like to place a simple yes no msg box, have tried the code i
> thought worked, but not having much success,
[quoted text clipped - 4 lines]
>
> Any help??????
bony_tony - 21 Dec 2006 00:25 GMT
Might want to change that to;
Sub askmsg()
If MsgBox("Some message", vbYesNo) = vbNo Then
ActiveWorkbook.Close True
Else
ActiveWorkbook.Saved = True
ActiveWorkbook.Close
End If
End Sub
If the 'Yes' is pressed on this one, it will close without saving
Tony
> i would like to place a simple yes no msg box, have tried the code i
> thought worked, but not having much success,
[quoted text clipped - 4 lines]
>
> Any help??????