LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 157
Default If pressed no to msgbox, then exit sub

Hi,

I have included the following 2 lines of code

msgbox ("Running of a Macro empties the UNDO stack. You should save your
workbook with a different version number before running this Macro. Press
Yes if you would you like to exit out of the macro and save your workbook.
Press No if you have already saved the workbook and would like to continue
with macro execution", vbOKCancel, "Warning") As msgboxresult
If msgboxresult = "Cancel" Then Exit Sub


When running the above code it bombs at the line - msgbox ("...") As
msgboxresult
The error im getting is -- compile error : statement invalid outside Type
Block

Please guide me as to what am doing wrong

--
Thanks a lot,
Hari
India


 
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
Which button was pressed? Adrian[_4_] Excel Programming 7 April 28th 04 04:55 PM
VB msgbox exit Fraggs[_3_] Excel Programming 2 April 10th 04 02:00 PM
If a called sub exit, how to the caller exit right away? luvgreen[_4_] Excel Programming 4 February 24th 04 05:06 PM
ComboBox DropDown when Key is pressed shrekut[_9_] Excel Programming 2 February 2nd 04 11:30 PM
If no FIND value is found, then a Msgbox to say so and exit sub L. Howard Kittle[_2_] Excel Programming 3 September 23rd 03 08:46 PM


All times are GMT +1. The time now is 05:01 PM.

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

About Us

"It's about Microsoft Excel"