Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Check for instance of EXCEL running

I'm trying to test for an existing instance of Excel already running.

In my VB6 code I do the following:

Dim oExcel As Object
Set oExcel = CreateObject("Excel.Application")

If Excel were already running I would do this:
Set oExcel = GetObject(, "Excel.Application")

How can I test to see if Excel is already running? I've found some examples
but they were a bit convoluted.

Thanks for any help.

Kevin


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default Check for instance of EXCEL running

Hi Kevin

Don't overcomplicate this. Just use GetObject. If it errs then excel's not
running and so you create one:

Dim oExcel As Object
On Error Resume Next
Set oExcel = GetObject(, "Excel.Application")
If oExcel Is Nothing Then
Set oExcel = CreateObject("Excel.Application")
End If

HTH. Best wishes Harald

"Kevin" skrev i melding
...
I'm trying to test for an existing instance of Excel already running.

In my VB6 code I do the following:

Dim oExcel As Object
Set oExcel = CreateObject("Excel.Application")

If Excel were already running I would do this:
Set oExcel = GetObject(, "Excel.Application")

How can I test to see if Excel is already running? I've found some

examples
but they were a bit convoluted.

Thanks for any help.

Kevin




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
my excel settings changed and i have only 1 instance running. Melissa Setting up and Configuration of Excel 1 March 28th 10 04:30 AM
Running Two Instance of Excel 2003 Simultaneously - Advice Please Dermot Excel Discussion (Misc queries) 11 February 20th 08 12:04 AM
How to determine if instance of Excel is running anandmr Excel Programming 7 December 23rd 03 05:24 PM
Check for Excel version before running? Ed[_9_] Excel Programming 2 December 18th 03 01:56 PM
opening and running macros in an Excel file in a new instance of Excel Malone[_2_] Excel Programming 0 September 30th 03 01:58 AM


All times are GMT +1. The time now is 09:13 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"