+ Reply to Thread
Results 1 to 3 of 3

Auto Open macro

Hybrid View

  1. #1
    Registered User
    Join Date
    06-16-2012
    Location
    Wisconsin, USA
    MS-Off Ver
    Excel 2010
    Posts
    24

    Auto Open macro

    How do I get a macro to start when I open a workbook? I have the following code that works fine when I run it. Any help would be appreciated. Thank you in advance.

    Option Explicit
    Public setDate As Date
    Sub UpdateTime()
        setDate = Now() + TimeValue("00:00:30")
        Application.OnTime setDate, "TimeUp"
        ActiveWorkbook.Save
    End Sub
    Last edited by Paul; 06-19-2012 at 05:15 PM. Reason: Added CODE tags for new user. Please do so yourself in the future.

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887

    Re: Auto Open macro

    Hi Siray,

    In the VBA Editor, double-click on the ThisWorkbook module and insert a line of code in the Workbook Open event to call your macro, e.g.
    Private Sub Workbook_Open()
    Call UpdateTime
    End Sub

  3. #3
    Registered User
    Join Date
    06-16-2012
    Location
    Wisconsin, USA
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: Auto Open macro

    Thank you for the discription, its working now.

+ 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