+ Reply to Thread
Results 1 to 2 of 2

How do I open an Access file with a macro in Excel?

  1. #1
    gaitkeeper
    Guest

    How do I open an Access file with a macro in Excel?

    I need a Microsoft Excel macro that will open an existing Microsoft Access
    database file. I have written a macro that lets me open a new Access file,
    but can't open an existing file. Please Help.
    P.S. It would be nice if I could run the macro that exists in Access through
    excel as well!

  2. #2
    Ron de Bruin
    Guest

    Re: How do I open an Access file with a macro in Excel?

    Try this gaitkeeper

    Sub test()
    On Error Resume Next
    Set ac = GetObject(, "Access.Application")
    If ac Is Nothing Then
    Set ac = GetObject("", "Access.Application")
    ac.OpenCurrentDatabase "C:\My Documents\db1_2K.mdb"
    ac.UserControl = True
    End If
    AppActivate "Microsoft Access"
    End Sub

    Sub test2()
    On Error Resume Next
    Set xl = GetObject(, "Excel.Application")
    If xl Is Nothing Then
    Set xl = GetObject("", "Excel.Application")
    xl.Workbooks.Open "c:\Data\book1.xls"
    xl.UserControl = True
    xl.Visible = True
    End If
    AppActivate "Microsoft Excel"
    End Sub


    --
    Regards Ron de Bruin
    http://www.rondebruin.nl



    "gaitkeeper" <[email protected]> wrote in message news:[email protected]...
    >I need a Microsoft Excel macro that will open an existing Microsoft Access
    > database file. I have written a macro that lets me open a new Access file,
    > but can't open an existing file. Please Help.
    > P.S. It would be nice if I could run the macro that exists in Access through
    > excel as well!




+ 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