Saturday, April 10, 2010

Opening up MS Access from Excel with VBA

 

One of my clients had a project where I needed to open up an Access database from Excel with the click of a button.

Here's the code.  "database.mdb" is the name of the database you want to open.

Sub OpenDB()
Dim myDir As String 

myDir = ActiveWorkbook.Path
Shell "C:\Program Files\Microsoft Office\Office11\msaccess.exe " _
& myDir & "\database.mdb"
End Sub

No comments:

Post a Comment