febrero127
10-22-2015, 10:18 AM
My goal is to close an already opened access database when Excel Opens. Before anyone asks why I am doing this, its because my excel file has a connection tied to this specific db that is opened.
The connection data that my excel file contains does not refresh if the db that is trying to connect is openend. Please help I am not too good with vba.
This one seemed to work but this actually opens the database (a copy) and then closes the copy, not the already opened db:
Dim accessApp As Object
Set accessApp = GetObject("c:path", "Access.Application")
accessApp.docmd.Quit
Set accessApp = Nothing
This one does not work and it gives me an error Object required:
Dim accessApp As Object
Dim s As String
s = "c:path"
Set accessApp = GetObject(s)
accessApp = docmd.Quit
The connection data that my excel file contains does not refresh if the db that is trying to connect is openend. Please help I am not too good with vba.
This one seemed to work but this actually opens the database (a copy) and then closes the copy, not the already opened db:
Dim accessApp As Object
Set accessApp = GetObject("c:path", "Access.Application")
accessApp.docmd.Quit
Set accessApp = Nothing
This one does not work and it gives me an error Object required:
Dim accessApp As Object
Dim s As String
s = "c:path"
Set accessApp = GetObject(s)
accessApp = docmd.Quit