Click here to Skip to main content
15,867,453 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In this project I’m using an object of Excel.application, to open the excel sheet but when I debug the code, I’m getting an error while executing ‘obj.workbooks.open(<path>)’ - and the error is “This action cannot be complete because the other application is busy. Choose switch to activate the busy application and correct the problem”
Someone please help.

What I have tried:

Set objExcel= CreateObject(“Excel.Application”)
Set xlWB = onjExcel.Workbooks.open(xl)
- where xl is a variable which stores my excel file path with extension.
Posted
Updated 2-Feb-18 5:45am

1 solution

Assuming that use of onjExcel is just a typo here and not in your code, it's likely that Excel is showing some sort of dialog box or message.

Put a breakpoint on
VB
Set xlWB = objExcel.Workbooks.open(xl)
and switch to the Excel application and have a look.

You may possibly have Excel open already for something else - try closing those instances if so.

Sometimes rebooting can help - or use Task Manager to ensure that all instances of Excel are indeed cleared from memory before trying to run your program again.

See also this Microsoft support article[^]
 
Share this answer
 
Comments
Ash_savvy 4-Feb-18 12:33pm    
Sorry for the typo😄 and I can’t start without appreciating the effort and time that you spent for my code, thank you so much my friend 😃
As you said, I placed the breakpoint at
‘Set xlWB = objExcel.Workbooks.open(xl)’
And I also double checked in Task Manager to ensure whether any instance of excel is active or not. But I came to know that when this line of code is executed - ‘Set xlWB = objExcel.Workbooks.open(xl)’ - I can see Microsoft Excel application in task manager, at that time itself I’m getting that error “This action cannot be complete because the other application is busy”.
Note: In references, the ‘Microsoft Excel 15.0 Object Library’ is checked ✅.
CHill60 4-Feb-18 16:48pm    
This may come down to a win32 versus win64 issue. VB6 cannot interact properly with win64 apps, it will be running under WOW64.
Is there any chance you could drop the use of VB6 (no longer supported) and use VB.NET (free)?
Ash_savvy 4-Feb-18 22:29pm    
Thank you so much my friend, let me try with Vb.net🙂

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900