+ Reply to Thread
Results 1 to 5 of 5

Code Execution has been interrupted - ??

  1. #1
    ina
    Guest

    Code Execution has been interrupted - ??

    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


  2. #2
    Bob Phillips
    Guest

    Re: Code Execution has been interrupted - ??

    Where does it break?

    --
    HTH

    Bob Phillips

    (remove xxx from email address if mailing direct)

    "ina" <[email protected]> wrote in message
    news:[email protected]...
    > 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
    >




  3. #3
    ina
    Guest

    Re: Code Execution has been interrupted - ??

    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"


  4. #4
    Tim Hull
    Guest

    Re: Code Execution has been interrupted - ??

    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.


    ina wrote:
    > 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"



  5. #5
    ina
    Guest

    Re: Code Execution has been interrupted - ??

    Good thanks, very strange VBA sometimes

    Tim Hull wrote:
    > 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.
    >
    >
    > ina wrote:
    > > 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"



+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1