ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to Stop VBA from executing (https://www.excelbanter.com/excel-programming/377980-how-stop-vba-executing.html)

hon123456

How to Stop VBA from executing
 
Dear all,

I have write VBA Code to close a workbook when it was open.
Now when I open the workbook, the workbook will close immediately, thus
I cannot edit the VBA Code. How can stop the VBA code from executing
and then I can edit the VBA code.

Thanks.


JMB

How to Stop VBA from executing
 
Try holding down the Shift key when you open the workbook.

"hon123456" wrote:

Dear all,

I have write VBA Code to close a workbook when it was open.
Now when I open the workbook, the workbook will close immediately, thus
I cannot edit the VBA Code. How can stop the VBA code from executing
and then I can edit the VBA code.

Thanks.



Les Stout[_2_]

How to Stop VBA from executing
 
JMB, You can also press ctrl/break(Pause) to stop the code.

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***

Nigel

How to Stop VBA from executing
 
Select disable macros on opening Excel.

If this does not appear open Excel and set security to medium, then close
Excel and open your problem workbook, then select disable macros.
--
Cheers
Nigel



"hon123456" wrote in message
ups.com...
Dear all,

I have write VBA Code to close a workbook when it was open.
Now when I open the workbook, the workbook will close immediately, thus
I cannot edit the VBA Code. How can stop the VBA code from executing
and then I can edit the VBA code.

Thanks.




[email protected]

How to Stop VBA from executing
 
Keep the shift button pressed when you open your workbook.

Regards,
Steve

Nigel schrieb:

Select disable macros on opening Excel.

If this does not appear open Excel and set security to medium, then close
Excel and open your problem workbook, then select disable macros.
--
Cheers
Nigel



"hon123456" wrote in message
ups.com...
Dear all,

I have write VBA Code to close a workbook when it was open.
Now when I open the workbook, the workbook will close immediately, thus
I cannot edit the VBA Code. How can stop the VBA code from executing
and then I can edit the VBA code.

Thanks.



JMB

How to Stop VBA from executing
 
My impression is it was an autoopen macro. Depending on how long it takes
the macro to run, I think there may not be enough time.

Personally, I keep a button on my toolbar to toggle events on/off
Sub ToggleEvents()
With Application
.EnableEvents = Not .EnableEvents
If .EnableEvents Then
.StatusBar = False
Else: .StatusBar = "Events Are Disabled"
End If
End With
End Sub

But the OP could also set security to medium or high prior to opening the
workbook.

"Les Stout" wrote:

JMB, You can also press ctrl/break(Pause) to stop the code.

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***


[email protected][_2_]

How to Stop VBA from executing
 
I have had this problem as well recently and I solved it by doing
this...

debug.assert 1 = 2

Adding this as the first line in your Auto_Open and it will break on
its own each time its run.

Hope that helps.

theSquirrel



JMB wrote:
My impression is it was an autoopen macro. Depending on how long it takes
the macro to run, I think there may not be enough time.

Personally, I keep a button on my toolbar to toggle events on/off
Sub ToggleEvents()
With Application
.EnableEvents = Not .EnableEvents
If .EnableEvents Then
.StatusBar = False
Else: .StatusBar = "Events Are Disabled"
End If
End With
End Sub

But the OP could also set security to medium or high prior to opening the
workbook.

"Les Stout" wrote:

JMB, You can also press ctrl/break(Pause) to stop the code.

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***




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

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