Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Warning Message before a Macro is Run

Is there a way to have a warning message pop-up before a macro is
applied (i.e., once you press the macro button, the warning will appear
and ask for a second confirmation of the process before it starts...)?

Thanks.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Warning Message before a Macro is Run

The following code will ask the user if they want to continue, and if
they choose not to, it will end the macro. This needs to be placed at
the top of the macro when you "edit" the macro. If you need help doing
that, write back.


if msgbox("Are you sure that you want to run this macro?",vbyesno, "Are
you sure?") = vbno then
exit sub
end if




On Dec 11, 10:06 pm, "amirstal" wrote:
Is there a way to have a warning message pop-up before a macro is
applied (i.e., once you press the macro button, the warning will appear
and ask for a second confirmation of the process before it starts...)?

Thanks.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Warning Message before a Macro is Run

Thanks Brian,

It did not work...
Here is how I tried:

Sub cleanblotter()
'
' cleanblotter Macro
' Macro recorded 12/11/2006 by Reuters LTD
' ifmsgbox("Are you sure that you want to clean the
blotter?",vbyesno,"Are you sure?")=vbno then
Exit Sub
End If

Range("AN19").copy
Range("AL19").PasteSpecial xlPasteValues

Range("A11:A1000,B11:B1000,D11:D1000,E11:E1000,G11 :G1000,I11:I1000,J11:J1000,K11:K1000").Select
Range("I11").Activate
Selection.ClearContents
Range("A11").Select

End Sub


Amir


Brian wrote:
The following code will ask the user if they want to continue, and if
they choose not to, it will end the macro. This needs to be placed at
the top of the macro when you "edit" the macro. If you need help doing
that, write back.


if msgbox("Are you sure that you want to run this macro?",vbyesno, "Are
you sure?") = vbno then
exit sub
end if




On Dec 11, 10:06 pm, "amirstal" wrote:
Is there a way to have a warning message pop-up before a macro is
applied (i.e., once you press the macro button, the warning will appear
and ask for a second confirmation of the process before it starts...)?

Thanks.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Warning Message before a Macro is Run


amirstal wrote:
Thanks Brian,

It did not work...
Here is how I tried:

Sub cleanblotter()
'
' cleanblotter Macro
' Macro recorded 12/11/2006 by Reuters LTD
' ifmsgbox("Are you sure that you want to clean the
blotter?",vbyesno,"Are you sure?")=vbno then
Exit Sub
End If

Range("AN19").copy
Range("AL19").PasteSpecial xlPasteValues

Range("A11:A1000,B11:B1000,D11:D1000,E11:E1000,G11 :G1000,I11:I1000,J11:J1000,K11:K1000").Select
Range("I11").Activate
Selection.ClearContents
Range("A11").Select

End Sub


Amir


Brian wrote:
The following code will ask the user if they want to continue, and if
they choose not to, it will end the macro. This needs to be placed at
the top of the macro when you "edit" the macro. If you need help doing
that, write back.


if msgbox("Are you sure that you want to run this macro?",vbyesno, "Are
you sure?") = vbno then
exit sub
end if




On Dec 11, 10:06 pm, "amirstal" wrote:
Is there a way to have a warning message pop-up before a macro is
applied (i.e., once you press the macro button, the warning will appear
and ask for a second confirmation of the process before it starts...)?

Thanks.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,726
Default Warning Message before a Macro is Run

Sub cleanblotter()
'
' cleanblotter Macro
' Macro recorded 12/11/2006 by Reuters LTD
' If MsgBox("Are you sure that you want to clean the blotter?", _
vbyesno,"Are you sure?")=vbno then Exit Sub

Range("AN19").copy
Range("AL19").PasteSpecial xlPasteValues

Range("A11:A1000,B11:B1000,D11:D1000,E11:E1000,G11 :G1000,I11:I1000,J11:J1000,K11:K1000").ClearConten ts
Range("A11").Select

End Sub

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"amirstal" wrote in message
ups.com...
Thanks Brian,

It did not work...
Here is how I tried:

Sub cleanblotter()
'
' cleanblotter Macro
' Macro recorded 12/11/2006 by Reuters LTD
' ifmsgbox("Are you sure that you want to clean the
blotter?",vbyesno,"Are you sure?")=vbno then
Exit Sub
End If

Range("AN19").copy
Range("AL19").PasteSpecial xlPasteValues

Range("A11:A1000,B11:B1000,D11:D1000,E11:E1000,G11 :G1000,I11:I1000,J11:J1000,K11:K1000").Select
Range("I11").Activate
Selection.ClearContents
Range("A11").Select

End Sub


Amir


Brian wrote:
The following code will ask the user if they want to continue, and if
they choose not to, it will end the macro. This needs to be placed at
the top of the macro when you "edit" the macro. If you need help doing
that, write back.


if msgbox("Are you sure that you want to run this macro?",vbyesno, "Are
you sure?") = vbno then
exit sub
end if




On Dec 11, 10:06 pm, "amirstal" wrote:
Is there a way to have a warning message pop-up before a macro is
applied (i.e., once you press the macro button, the warning will appear
and ask for a second confirmation of the process before it starts...)?

Thanks.




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro Warning Message Tendresse Excel Discussion (Misc queries) 0 February 29th 08 07:44 AM
Macro Warning Message Lisa Neron Excel Discussion (Misc queries) 5 January 16th 08 01:27 AM
Stopping the Macro Warning Message Jurrasicway Excel Programming 2 June 19th 06 02:57 PM
Stoping the Macro Warning Message Jurrasicway Excel Discussion (Misc queries) 5 June 19th 06 02:56 PM
On Close Macro - stop warning message M Shannon Excel Programming 2 October 2nd 04 04:04 PM


All times are GMT +1. The time now is 04:03 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"