Link to home
Start Free TrialLog in
Avatar of Tushar Sawant
Tushar Sawant

asked on

Need your help for open excel instance - VBA

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
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

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
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.
Avatar of Tushar Sawant
Tushar Sawant

ASKER

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
What happens when you open Excel by clicking on it? Does the same error message appear?
Yes same error appear and I code execution is getting stop.
U:\workarea\hstbar.xla" cannot be found. or please check file spell.
ASKER CERTIFIED SOLUTION
Avatar of Dale Fye
Dale Fye
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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..
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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