+ Reply to Thread
Results 1 to 2 of 2

Error with application.ontime...macro runs twice next day..

  1. #1
    Forum Contributor
    Join Date
    11-08-2012
    Location
    Dubai
    MS-Off Ver
    Excel For Mac V16 365
    Posts
    145

    Unhappy Error with application.ontime...macro runs twice next day..

    HELLO!!,

    THANKS FOR LOOKING BY,,

    I'm kindaf tired lookig for a solution for this...its been three weeks....

    i did a macro for reuters terminal so that different excel sheets automatically open at pre defined time ..pick up the market rates and then save in a shared folder...this process should repeat everyday....i have around 14 excel sheets at different timings to open.

    My problem is after the day i run the macro...that is next day morning..when the first file opens..it tries to open twice...and pops up the error message "Do you want to open already open file" and my macro gets stuck der....this error message is my problem..it happens the next day...the macro works perefectly the day i run the macro..but when the date moves to next date..this issue happens...the file tries to open twice...

    what can be the reason for this issue??

    is it because of cache memory...that file is not properly closed??? or shouldn't i put a loop in the end...does it runs twice because of the loop????


    Sub Timer()
    Application.OnTime TimeValue("12:08:00"), "a"
    Application.OnTime TimeValue("12:10:00"), "b"
    End Sub

    Sub a()
    Workbooks.Open Filename:="Z:\abcd"
    End Sub

    Sub b()
    Workbooks.Open Filename:="Z:\efgh"
    Call Timer
    End Sub

    Sub ScheduleAProcedure()
    Application.OnTime Now + TimeSerial(0, 0, 10), "SaveBook"
    End Sub
    Sub SaveBook()
    Dim sFile As String
    With ActiveSheet.UsedRange
    .Value = .Value
    End With
    sFile = "fixingrates" & " " & Format(Now(), "dd.mm.yy.hh.mm") & ".xls"
    ActiveWorkbook.SaveAs Filename:="Z:\checker\" & sFile
    ThisWorkbook.Close Saved = True
    End Sub
    this is the macro in each workbook that runs when workbook opens.


    any suggestions

    many thanks

    Gokz

  2. #2
    Forum Contributor
    Join Date
    11-08-2012
    Location
    Dubai
    MS-Off Ver
    Excel For Mac V16 365
    Posts
    145

    Re: Error with application.ontime...macro runs twice next day..

    Any help???

+ 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