We help IT Professionals succeed at work.

Need your help for open excel instance - VBA

86 Views
Last Modified: 2017-11-15
Hello,

Could you please help me to know all open Excel instance ?
Also I want to set the Excel object for latest instance using VBA.

I am using Excel 2010.

Please help
Comment
Watch Question

Ryan ChongSoftware Tead Lead / Business Analyst / System Analyst / Data Engineer / Applications Consultant
CERTIFIED EXPERT

Commented:
try use getObject to get the existing instance

GetObject Function (Visual Basic) (check the example provided)
https://msdn.microsoft.com/en-us/library/e9waz863(v=vs.90).aspx

GetObject and CreateObject behavior of Office automation servers
https://support.microsoft.com/en-sg/help/288902/getobject-and-createobject-behavior-of-office-automation-servers
ste5anSenior Developer
CERTIFIED EXPERT

Commented:
As far as I know: There is no reliable way to get the last instance. Especially as Excel uses under normal circumstances only one instance.

So the question is: What problem are you trying ro solve.

Author

Commented:
HI Team,

When I open the new excel instance using set xlApp = new excel.application
or set xlApp = createobject("excel.application") it gives me Application busy error and object not getting set.
I observed there is a pop up message come while set the xlapp like "U:\workarea\hstbar.xla" cannot be found. or please check file spell.

I cant use getobject to set the object it set the existing instance so I don't want to do this.
I have to workaround with new excel instance.

Please help me. I stuck on this topic from so many days

Thanks in advace
ste5anSenior Developer
CERTIFIED EXPERT

Commented:
What happens when you open Excel by clicking on it? Does the same error message appear?

Author

Commented:
Yes same error appear and I code execution is getting stop.
U:\workarea\hstbar.xla" cannot be found. or please check file spell.
Owner, Dev-Soln LLC
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2010
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
ste5anSenior Developer
CERTIFIED EXPERT

Commented:
Well, then check you Excel installation, an add-in is broken..  reinstall it or uninstall it.

btw, u: sounds like a network drive. Locating an add-in on a network drive is generally a bad idea, cause it means that your installation does not fully work, when there is no network..
Dale FyeOwner, Dev-Soln LLC
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2010
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
TracyVBA Developer
CERTIFIED EXPERT

Commented:
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I have recommended this question be closed as follows:

Split:
-- Dale Fye (https:#a42069653)
-- Dale Fye (https:#a42090207)


If you feel this question should be closed differently, post an objection and the moderators will review all objections and close it as they feel fit. If no one objects, this question will be closed automatically the way described above.

broomee9
Experts-Exchange Cleanup Volunteer
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.