Stop Statement ignored in VBA

gunnark

New Member
Joined
Feb 10, 2005
Messages
3
A colleague asked me to test one of his Excel-projects, a medium sized Workbook with 4 code modules and 6 user forms. The first thing I did was to put a Stop statement in the beginning of the Workbook_Open Sub, saved the Workbook and closed it. Upon reopening the Workbook I’d expected the Stop statement to throw me into debug mode in the Workbook_Open Sub, but it didn’t. I replaced the Stop statement with a Msgbox and resaved the workbook and closed it. When I reopened the workbook the Msgbox showed up. I once again put Stop statement in the code on the line after the Msgbox resaved the workbook and closed it. When I reopened the workbook the Msgbox showed up but the Stop statement was ignored. What’s happening? Isn’t a Stop statement unconditional? I’m running Excel 2003 on a computer running XP with SP2.

//Gunnar[/b]
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
I tried to duplicate your results -
When I put STOP as the first line of code it does as you expected, enters debug mode. I'm using Excel 2000 and Windows XP Pro. Maybe it's unique to Excel 2003? I uninstalled Excel 2003 due to a few problems I was having with it.
 
Upvote 0
I tried to duplicate your results -
When I put STOP as the first line of code it does as you expected, enters debug mode. I'm using Excel 2000 and Windows XP Pro. Maybe it's unique to Excel 2003? I uninstalled Excel 2003 due to a few problems I was having with it.
 
Upvote 0
Yes, the code is protected, but I ran it in unprotected mode. I should also have mentioned that in all my own projects the Stop statement in the Workbook_Open Sub works as expected.

//Gunnar
 
Upvote 0

Forum statistics

Threads
1,214,593
Messages
6,120,434
Members
448,961
Latest member
nzskater

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top