RE: Opening Access database
- From: SeanC UK <SeanCUK@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 21 Jul 2007 06:34:04 -0700
Hi Matt,
Here's a quick solution (I've yet to find one by using the created object
itself), although I'm not very keen on this method.
oApp.Visible = True
SendKeys "% x"
I know that sometimes quotes etc are replaced in these community
communications, so that is: SendKeys doublequote percent space x doublequote
Anyway, this should work in general, I have tested and it worked for me. It
simply sends ALT space then X to maximise the window. Drawbacks are that you
can't use it when stepping through the code as the VBA editor will remain on
top and you'll be sending the keystrokes to it and not Access. Also, if some
greedy application steals focus (unlikely if you write it straight after
Visible = True), then that app will receive the keystrokes. To test in the
debug environment simply place a breakpoint after the sendkeys and run the
code.
There are other methods, search for Shell Function in the VBA help, which
allow you to run an app from the shell and at the same time you can set the
opening window state. You will get the Prog ID returned, but I don't know if
you'll have enough control over the app as you might require. Also, using the
CreateObject method, the app is killed when the object is killed, but using
the Shell method then you will have to write code specifically to kill the
app when you're done.
If I find a method using the object directly then I'll post again. Hope this
helps a bit.
Sean.
"Launchnet" wrote:
The following code works fine, except that the database opens in a small.
window. I want it to always open full screen. Can someone take a look and
advise me on what code to add ?
Thanks
Matt@Launchnet
Sub NewAccessWithDocument()
'ActiveWorkbook.FollowHyperlink Address:="C:\_Matts Data\0_avp\
avpdatabasesample.mdb"
Dim LPath As String
Dim LCategoryID As Long
'Path to Access database
LPath = "C:\_Matts Data\0_avp\avpdatabasesample.mdb"
'Open Access and make visible
Set oApp = CreateObject("Access.Application")
oApp.Visible = True
'Open Access database as defined by LPath variable
oApp.OpenCurrentDatabase LPath
End Sub
--
Please take a look at www.openoursite.com Click on: "Keywords" and then
Click on "Matt's Story" and if you are a man, you should be very happy that
you read my story. God Bless for everyones help.
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.aspx/excel-programming/200707/1
- Follow-Ups:
- RE: Opening Access database
- From: Launchnet via OfficeKB.com
- RE: Opening Access database
- References:
- Opening Access database
- From: Launchnet
- Opening Access database
- Prev by Date: Re: Validation
- Next by Date: RE: problem column (B)
- Previous by thread: Opening Access database
- Next by thread: RE: Opening Access database
- Index(es):
Relevant Pages
|