about OLE automation

K

keyur

I have an excel spreadsheet thats linked to an access
table. I am using this table to create a form.
I am using the code below to open an access this form
(from excel) where there's a code for form_open event to
print report of the form. after i close everything excel
keeps running in the background. so the next time i open
the same excel file i see two VBA project (of the same
file) open. am i missing here something? i hope i am
making myself clear.

thanks for any help.


' Initialize string to database path.
Const strConPathToSamples = "C:\Documents and
Settings\vku\My Documents\"

strDB = strConPathToSamples & "Stock Cards.mdb"

' Create new instance of Microsoft Access.
Set appAccess = CreateObject("Access.Application")

' Open database in Microsoft Access window.
appAccess.OpenCurrentDatabase strDB

appAccess.visible = True
appAccess.WindowState = ppWindowMaximized

' Open Orders form.
appAccess.DoCmd.OpenForm "Stock Cards"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top