Code Execution has been interrupted - ??

I

ina

Hello I have this sub and since today I have this error the code stops
very strangely tell me that there is a code execution breaking. any
suggestions??

Public Sub Workbook_Open()
' ************
' Variables
' ************
Dim dtmTime As Date
Dim dtmSave As Date
Dim oExec As Object

' ************
' Call function OpenPHObject; in order to execute sub operations I need
to open this software
' ************
Set oExec = OpenPHObject()

' ************
' Cursor in clock shape
' ************
Application.Cursor = xlWait
DoEvents

On Error Resume Next
' ************
' After seven seconds the macros has been launched
' ************
dtmTime = Now + TimeValue("00:00:07")
' ************
' Open the sub in thisworkbook
' ************
Application.OnTime dtmTime, "thisworkbook.operations"
Application.Cursor = xlDefault
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:= _
"C:\test\testsave.xls", ReadOnlyRecommended:=False, CreateBackup:=False
'Application.DisplayAlerts = True
' ************
' Now + 7seconds + 30 seconds --> launch SAVEandEXIT and close PH
' ************
dtmSave = dtmTime + TimeValue("00:00:30")
Application.OnTime dtmSave, "thisWorkBook.Save_Exit"

End Sub
 
B

Bob Phillips

Where does it break?

--
HTH

Bob Phillips

(remove xxx from email address if mailing direct)
 
I

ina

in this part

'Application.DisplayAlerts = True ' here but if I comment goes to
dtmSave because dtmSave = 00:00:00
' ************
' Now + 7seconds + 30 seconds --> launch SAVEandEXIT and close PH
' ************
dtmSave = dtmTime + TimeValue("00:00:30") ' here
Application.OnTime dtmSave, "thisWorkBook.Save_Exit"
 
T

Tim Hull

I had this problem after hitting Control-Break during the execution of
a macro. Once it starts, it seems to (somewhat randomly) affect all
MS-Office macros.

The solution for me was very simple though: reboot the computer. (A
complete reboot was required - simply logging off was not sufficient).

The problem seems to have nothing to do with the macros themselves -
after rebooting, they're all working fine.
 
I

ina

Good thanks, very strange VBA sometimes

Tim said:
I had this problem after hitting Control-Break during the execution of
a macro. Once it starts, it seems to (somewhat randomly) affect all
MS-Office macros.

The solution for me was very simple though: reboot the computer. (A
complete reboot was required - simply logging off was not sufficient).

The problem seems to have nothing to do with the macros themselves -
after rebooting, they're all working fine.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top