+ Reply to Thread
Results 1 to 2 of 2

Auto_Open Macro Via Access

  1. #1
    Registered User
    Join Date
    02-20-2005
    Posts
    5

    Auto_Open Macro Via Access

    I have an Access database that prepares financial data and then opens excel. Excel is linked to the DB and imports the data. I have an Auto_Open macro to import the data. Well, to be exact, it refreshes the query. That macro works just fine when I open the file in Excel, but when I use Access to open the Excel file, the Auto_Open macro does not execute. Any thoughts?

    PJ

  2. #2
    Forum Contributor
    Join Date
    11-16-2004
    Posts
    282
    I'm assuming you're using VBA in Access to open the Excel workbook...This is from the Microsoft Knowledge Base:

    An Auto_Open macro is ignored when a workbook is opened programmatically by using the Open method. ...

    Another way to automatically run a macro when you open a workbook is to write a VBA procedure in the Open event of the workbook by using the Visual Basic Editor. The Open event is a built-in workbook event that runs its macro code each time you open the workbook.


    In the Project Explorer window, right-click the ThisWorkbook object, and then click View Code on the shortcut menu.
    In the Object list above the Code window, select Workbook. This will automatically create an empty procedure for the Open event like this:

    Private Sub Workbook_Open()

    End Sub


    For the full article:
    http://office.microsoft.com/en-us/as...346281033.aspx

    Hope this helps,
    theDude

+ 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