Time Dependent Macro
Results 1 to 6 of 6

Thread: Time Dependent Macro
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    Oct 2003
    Posts
    5
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Time Dependent Macro

    I have a spreadsheet that contains 25 hyperlinks to other spreadsheets on my network. I have created a macro that prints all these files once a week. Does anyone know if its possible to get this macro to run at at certain time every week? Essentially all I would have to do is leave the pc logged on with the spreadsheet open and it would just start off under its own steam.

    I am running Excel 97 and NT

    Many thanks in advance.

  2. #2
    MrExcel MVP
    Moderator
    SydneyGeek's Avatar
    Join Date
    Aug 2003
    Location
    Sydney, Australia
    Posts
    12,255
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    2 Thread(s)

    Default Re: Time Dependent Macro

    You need to use the OnTime event. See this link

    http://www.mrexcel.com/board2/viewto...133&highlight=

    Denis

  3. #3
    Board Regular Davers's Avatar
    Join Date
    Sep 2002
    Location
    Michigan
    Posts
    1,165
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Time Dependent Macro

    And just in case you need an idea or 2...look at this link:

    http://www.mrexcel.com/board2/viewto...730&highlight=

    Dave M.

  4. #4
    New Member
    Join Date
    Oct 2003
    Posts
    5
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Time Dependent Macro

    Thanks for the help guys, unfortunately putting OnTime into the help files on VBE does not come up with anything.

    Thanks again.

  5. #5
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Sydney, Australia
    Posts
    2,940
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Time Dependent Macro

    Here's OnTime explained in the help. Please post back if you can't get something to work




    OnTime Method
    See Also Applies To Example Specifics
    Schedules a procedure to be run at a specified time in the future (either at a specific time of day or after a specific amount of time has passed).

    expression.OnTime(EarliestTime, Procedure, LatestTime, Schedule)

    expression Required. An expression that returns an Application object.

    EarliestTime Required Variant. The time when you want this procedure to be run.

    Procedure Required String. The name of the procedure to be run.

    LatestTime Optional Variant. The latest time at which the procedure can be run. For example, if LatestTime is set to EarliestTime + 30 and Microsoft Excel is not in Ready, Copy, Cut, or Find mode at EarliestTime because another procedure is running, Microsoft Excel will wait 30 seconds for the first procedure to complete. If Microsoft Excel is not in Ready mode within 30 seconds, the procedure won’t be run. If this argument is omitted, Microsoft Excel will wait until the procedure can be run.

    Schedule Optional Variant. True to schedule a new OnTime procedure. False to clear a previously set procedure. The default value is True.

    Remarks
    Use Now + TimeValue(time) to schedule something to be run when a specific amount of time (counting from now) has elapsed. Use TimeValue(time) to schedule something to be run a specific time.

    Example
    This example runs my_Procedure 15 seconds from now.

    Application.OnTime Now + TimeValue("00:00:15"), "my_Procedure"
    This example runs my_Procedure at 5 P.M.

    Application.OnTime TimeValue("17:00:00"), "my_Procedure"
    This example cancels the OnTime setting from the previous example.

    Application.OnTime EarliestTime:=TimeValue("17:00:00"), _
    Procedure:="my_Procedure", Schedule:=False

  6. #6
    New Member
    Join Date
    Oct 2003
    Posts
    5
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Time Dependent Macro

    Ok guys got it, thanks for your help.

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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