ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Catching VbMsgBoxResult (https://www.excelbanter.com/excel-programming/315302-catching-vbmsgboxresult.html)

jose luis

Catching VbMsgBoxResult
 

Hi All,

How could i catch the result of a MsgBox and derive actions from th
user decision? Any help welcome!.

Thanks in advance

jose luis

P.D. Here is what i though will do the trick. I was wrong.


GuardarAntes()
MsgBox "Save Changes?", vbYesNoCancel, "Save?"

If VbMsgBoxResult.vbYes = 6 Then
MsgBox "Yes"
End If
If VbMsgBoxResult.vbNo = 7 Then
MsgBox "No"
End If
End Su

--
jose lui
-----------------------------------------------------------------------
jose luis's Profile: http://www.excelforum.com/member.php...fo&userid=1331
View this thread: http://www.excelforum.com/showthread.php?threadid=27394


doco[_2_]

Catching VbMsgBoxResult
 
Public Sub catchResponse()
Dim iResponse As Integer

iResponse = MsgBox("Please Respond", vbYesNo, "My Response")

MsgBox "My Resonse Is: " & iResponse, vbInformation, "Resonse"

End Sub



"jose luis" wrote in message
...

Hi All,

How could i catch the result of a MsgBox and derive actions from the
user decision? Any help welcome!.

Thanks in advance

jose luis

P.D. Here is what i though will do the trick. I was wrong.


GuardarAntes()
MsgBox "Save Changes?", vbYesNoCancel, "Save?"

If VbMsgBoxResult.vbYes = 6 Then
MsgBox "Yes"
End If
If VbMsgBoxResult.vbNo = 7 Then
MsgBox "No"
End If
End Sub


--
jose luis
------------------------------------------------------------------------
jose luis's Profile:
http://www.excelforum.com/member.php...o&userid=13312
View this thread: http://www.excelforum.com/showthread...hreadid=273940




Neil[_11_]

Catching VbMsgBoxResult
 
Jose
Try this

Sub doit()
Dim Response
Response = MsgBox("Save Changes", vbYesNoCancel, "Save")
If Response = vbYes Then
MsgBox "Yes"
Else
MsgBox "no"
End If
End Sub

Neil

"jose luis" wrote in message
...

Hi All,

How could i catch the result of a MsgBox and derive actions from the
user decision? Any help welcome!.

Thanks in advance

jose luis

P.D. Here is what i though will do the trick. I was wrong.


GuardarAntes()
MsgBox "Save Changes?", vbYesNoCancel, "Save?"

If VbMsgBoxResult.vbYes = 6 Then
MsgBox "Yes"
End If
If VbMsgBoxResult.vbNo = 7 Then
MsgBox "No"
End If
End Sub


--
jose luis
------------------------------------------------------------------------
jose luis's Profile:
http://www.excelforum.com/member.php...o&userid=13312
View this thread: http://www.excelforum.com/showthread...hreadid=273940





All times are GMT +1. The time now is 07:20 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com