CreateObject - start Access from Excel
Roedd <<Piers 2k wedi ysgrifennu:
Hi folks,
Am trying to start an Access database from VBA, but it closes itself
when the code finishes. I simply don't want this to happen. The
following code works fine if I change the Access into Word (see the
comment):
Sub StartApp()
Dim OtherApp As Object
' Set OtherApp = CreateObject("Word.Application")
Set OtherApp = CreateObject("Access.Application")
OtherApp.Visible = True
End Sub
Any help please?
TIA,
Piers
Move the declaration (Dim statement) outside the sub procedure. The variable
is going out of scope when the procedure exits and this kills the
application it refers to.
--
Rob
|