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
1469Asked:
Who is Participating?
 
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
 
Éric MoreauSenior .Net ConsultantCommented:
Hi 1469,

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

Cheers!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.