• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 177
  • Last Modified:

cheking if there si an excel process, and use it to open int this instance a book

Hello,

I´m looking for the way to look if there is an excel instance activate to use after thisone to open a book, and not open then a new excel instance.

regards
0
1469
Asked:
1469
1 Solution
 
Éric MoreauSenior .Net ConsultantCommented:
Hi 1469,

you need to use GetObject. See http://www.xtremevbtalk.com/t135815.html for a sample

Cheers!
0
 
bruintjeCommented:
Hello 1469,

you could use the code GetObject
source: http://support.microsoft.com/default.aspx?scid=kb;en-us;Q288902
---------
Dim xlApp as Object
'use a resume next to prevent an error dialog
on error resume next
'try to get the running excel
Set xlApp = GetObject(,"Excel.Application" )
'now we get an error but the resume next is going to the next line
if xlApp is Nothing then
  'if there is no excel running create one
  Set xlApp = CreateObject("Excel.Application" )
end if
---------

hope this helps a bit
bruintje
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now