iwantacookie
New Member
- Joined
- Sep 16, 2009
- Messages
- 3
Hi,
I did find another similar post but it didn't solve my specific problem and I didn't want to hijack it.
I am trying to convert my Excel 2003 workbooks to Excel 2007. My current macros all work great and one of them is to open an MS access 2003 db. I've converted the MS Access db to 2007 and the workbooks to 2007. Now when I run the macro to open the database, it opens for an instant, then immediately closes. I've stepped through the VBA script and it is working fine, but as soon as the macro hits "End Sub", Access closes.
From what I've gathered, I need to be using code to first open Access, and then open my database. This is not what my code does currently...
Currently, my code is this:
the AccessLocation, is a conglomeration of other bits of code i've put together to direct to a H:/XXX/XXX/XXX.accdb location (the prefix to the *.accdb file is always different thus the AccessLocation bit).
So, my question is, what do I change my code to?
I noticed some people using a "Shell" command? But I cannot work out how to get my AccessLocation bit into that.
HELP!
Thanks
I did find another similar post but it didn't solve my specific problem and I didn't want to hijack it.
I am trying to convert my Excel 2003 workbooks to Excel 2007. My current macros all work great and one of them is to open an MS access 2003 db. I've converted the MS Access db to 2007 and the workbooks to 2007. Now when I run the macro to open the database, it opens for an instant, then immediately closes. I've stepped through the VBA script and it is working fine, but as soon as the macro hits "End Sub", Access closes.
From what I've gathered, I need to be using code to first open Access, and then open my database. This is not what my code does currently...
Currently, my code is this:
Code:
Dim acApp As Object
Set acApp = GetObject(AccessLocation, "access.application")
acApp.Visible = true
the AccessLocation, is a conglomeration of other bits of code i've put together to direct to a H:/XXX/XXX/XXX.accdb location (the prefix to the *.accdb file is always different thus the AccessLocation bit).
So, my question is, what do I change my code to?
I noticed some people using a "Shell" command? But I cannot work out how to get my AccessLocation bit into that.
HELP!
Thanks