ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Warning Message (https://www.excelbanter.com/excel-discussion-misc-queries/122555-warning-message.html)

tom

Warning Message
 
Prior to executing a Macro in a workbook, I would like a Warning message to
pop-up asking the user to verify they are wanting to run this macro.

TFTH,
Tom

Eric

Warning Message
 
Just include code in your macro that includes an OK/Cancel Box -- and have OK
be continue running, have cancel stop the macro there.

"tom" wrote:

Prior to executing a Macro in a workbook, I would like a Warning message to
pop-up asking the user to verify they are wanting to run this macro.

TFTH,
Tom


Dave Peterson

Warning Message
 
Option Explicit
sub yourmacro()

resp = msgbox(Prompt:="wanna run this?", buttons:=vbyesno)

if resp = vbno then exit sub

....
end sub



tom wrote:

Prior to executing a Macro in a workbook, I would like a Warning message to
pop-up asking the user to verify they are wanting to run this macro.

TFTH,
Tom


--

Dave Peterson

Ken Johnson

Warning Message
 

tom wrote:
Prior to executing a Macro in a workbook, I would like a Warning message to
pop-up asking the user to verify they are wanting to run this macro.

TFTH,
Tom


Hi Tom,

If you are able to edit each macro's code then you could have each
macro start off with these three lines...

Dim msgCheck As VbMsgBoxResult
msgCheck = MsgBox("Are you sure you want to blah blah?", vbYesNo)
If msgCheck = vbNo Then Exit Sub

Edit "blah blah" to something applicable to the macro's function.

Ken Johnson


Dave Peterson

Warning Message
 
Option Explicit
sub yourmacro()

dim resp as long '<-- I forgot this!

resp = msgbox(Prompt:="wanna run this?", buttons:=vbyesno)

if resp = vbno then exit sub

....
end sub

Dave Peterson wrote:

Option Explicit
sub yourmacro()

resp = msgbox(Prompt:="wanna run this?", buttons:=vbyesno)

if resp = vbno then exit sub

....
end sub

tom wrote:

Prior to executing a Macro in a workbook, I would like a Warning message to
pop-up asking the user to verify they are wanting to run this macro.

TFTH,
Tom


--

Dave Peterson


--

Dave Peterson


All times are GMT +1. The time now is 10:09 AM.

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