I have code that Runs Macros is Access, then opens up Excel, then goes back to the same Access Database to run more macros. Everything works fine, except when it goes back to access, it opens up a new Access window and calls the same database again. How do I make it work so it does back to the Access window already open? I believe the problem is with my Excel code- see below:
Sub open_access2()
Dim DB As Object
Dim pth As String
pth = ActiveWorkbook.Path & "\Jewelry Labels.mdb"
Set DB = CreateObject("Access.Application")
DB.Visible = False
DB.OpenCurrentDatabase (pth)
DB.Docmd.RunMacro "Print_Labels" ' Macro name in DataBase
Set DB = Nothing
End Sub
Sub open_access2()
Dim DB As Object
Dim pth As String
pth = ActiveWorkbook.Path & "\Jewelry Labels.mdb"
Set DB = CreateObject("Access.Application")
DB.Visible = False
DB.OpenCurrentDatabase (pth)
DB.Docmd.RunMacro "Print_Labels" ' Macro name in DataBase
Set DB = Nothing
End Sub