Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default CreateObject - start Access from Excel

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default 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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default CreateObject - start Access from Excel

Arrrggghhh! Don't you hate it when it's obvious!

Thanks - much appreciated!


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 253
Default CreateObject - start Access from Excel

It does not close if you open a file
Regards
JY
"Piers 2k" wrote in message
...
Arrrggghhh! Don't you hate it when it's obvious!

Thanks - much appreciated!




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I have an access to XL Start folder? kija Excel Worksheet Functions 1 August 30th 09 02:02 PM
Createobject returns null in Excel [email protected] Excel Discussion (Misc queries) 1 March 27th 06 04:04 AM
Excel CreateObject on server Dennis Redfield Excel Programming 9 July 15th 05 10:09 PM
Start button / timing access vecia Excel Programming 0 October 25th 04 11:56 PM
CreateObject("Excel.Application") - Access denied Luca[_2_] Excel Programming 0 February 6th 04 01:21 PM


All times are GMT +1. The time now is 07:50 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"