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


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.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Éric MoreauSenior .Net ConsultantCommented:
Hi 1469,

you need to use GetObject. See for a sample

Hello 1469,

you could use the code GetObject
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.