Window position issue when launch Access from Excel VBA

sagain2k

Board Regular
Joined
Sep 8, 2002
Messages
94
I can launch Access from an Excel macro fine like this:
-----------------------------
Sub ActivateAccess()
Dim appAccess As Object
FnameTest = "Testfile.mdb"
DocPath = "D:\Data\Dbase"
FnameTemp = DocPath & FilenameTest
Set appAccess = GetObject(FnameTemp)
appAccess.Visible = True
End Sub
---------------------------------

My problem is that when activating Access this way the "switchboard" form window (and other subsequent switchboard form windows) wind up getting placed at the top left of the screen (and another one gets shoved off to the right edge when it's opened).

When I simply open Access normally via Windows Explorer or the Program menu, the switchboard form windows all appear nicely centered and placed as they should be.

Is there some parameter/argument I need to add to control the way these form windows are being positioned? Thanks for any help!
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
I noticed a typo that needed correcting (wrong filename variable)--here's the corrected code. FnameTest and FnameTemp were defined as Public:

Public FnameTest
Public FnameTemp
--------------------------
Sub ActivateAccess()
Dim appAccess As Object
FnameTest = "Testfile.mdb"
DocPath = "D:\Data\Dbase"
FnameTemp = DocPath & FnameTest
Set appAccess = GetObject(FnameTemp)
appAccess.Visible = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,716
Members
448,985
Latest member
chocbudda

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top