Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Option to continue or cancel
I have a macro which deletes completed jobs from a spreadsheet. Since this action is not reversible I'd like an option box of some sort to appear when the macro is first invoked to say that the action is not reversible and then have a proceed or cancel option which would either execute the macro or end out of it
Thanks Ken G. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Option to continue or cancel
KenG
Here is a bit of code you could use. Sub msg_box() Dim ans As String ans = MsgBox("Attention you are about to delete are you sure you wan to?", vbYesNo) If ans = vbYes Then 'your code ElseIf ans = vbNo Then Exit Sub End If End Sub Charle -- Message posted from http://www.ExcelForum.com |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Option to continue or cancel
Try
Select Case MsgBox("Please Confirm " _ & "You Wish To Permantley Delete This Record", _ vbYesNo + vbExclamation + vbDefaultButton2) Case vbYes Delete Record code here End Selec -- Message posted from http://www.ExcelForum.com |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Option to continue or cancel
Ken,
Adapt this. It is just a Msg box that then when "yes" is slected it closes down any open workbook ---------------- Dim Msg, Style, Title, Response Msg = "Wellcome to the proposed outline" & Chr(13) & _ "It is advised that you should close all other open workbooks to prevent potential conflict with this model." & Chr(13) & _ "To close and save other spreadsheets press YES?" & Chr(13) & _ "To ignore this warning and keep existing workbooks open, press NO" ' Define message." Style = vbYesNo + vbExclamation + vbDefaultButton2 ' Define buttons. Title = "Selection" ' Define title. 'Display message. Response = MsgBox(Msg, Style, Title) If Response = vbYes Then ' User chose Yes. For Each wkb In Workbooks If Not wkb Is ThisWorkbook Then wkb.Close savechanges:=True End If Next wkb End If "Ken G" wrote in message ... I have a macro which deletes completed jobs from a spreadsheet. Since this action is not reversible I'd like an option box of some sort to appear when the macro is first invoked to say that the action is not reversible and then have a proceed or cancel option which would either execute the macro or end out of it. Thanks, Ken G. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Continue Quote | Setting up and Configuration of Excel | |||
Workbook_BeforeClose(Cancel As Boolean) - Cancel won't work | Setting up and Configuration of Excel | |||
How do I cancel the "Send this Sheet" option? | Excel Discussion (Misc queries) | |||
to continue down in the same row | Excel Discussion (Misc queries) | |||
Abort or continue | Excel Programming |