Open Access Database with VBA

K

Keith

I have created a macro in an Excel workbook to do various things with a web
query, then export one sheet of the workbook as a txt file. I then get the
macro to open Access.

What I am wanting to do is:- I want my macro to, not only open Access, but
to open a specific Access Database and if possible, run a macro within that
database to import the data that I have exported from Excel.

Any ideas?

Thanks
 
R

Ron de Bruin

Try this Keith

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


I never try to open a macro in Access ?
 
Top