Hi,
I have an Access db that I would like to open each time i open an Excel workbook. As soon as I select "Open" on the "Unsafe Expressions Are Not Blocked" dialoge, the database opens and then instantly closes. Why does it keep closing on me? The code is below. Any help would be greatly appreciated.
Thanks!
Cory
I have an Access db that I would like to open each time i open an Excel workbook. As soon as I select "Open" on the "Unsafe Expressions Are Not Blocked" dialoge, the database opens and then instantly closes. Why does it keep closing on me? The code is below. Any help would be greatly appreciated.
Thanks!
Cory
Code:
Private Sub Workbook_Open()
Dim strMyDatabase As String
Dim appAccess As Access.Application
strMyDatabase = "C:\DatabaseName.mdb"
Set appAccess = CreateObject("Access.Application")
appAccess.OpenCurrentDatabase strMyDatabase
appAccess.Visible = True
Set appAccess = Nothing
End Sub