Microsoft excel is waiting for other program to finish OLE Action

D

Deepak

Hi,
I am trying to open an excel sheet by using VBA in
Excel. But, this particular sheet is maintained by other
person and is password protected. My code works perfect
when the file is opened by the other person
in the editing mode but fails to open the file when its
closed or not in the editing mode. I am not able to trace
the reason. I am left with this error message when the
file is closed by the other person.

"Microsoft excel is waiting for other program to finish
OLE action"

Code:
Dim xls as New Excel.Application

xls.workbooks.open("G:\sample.xls")

Excel fails when I try to open this location ... why does
it do so ??????????/
 
B

BrianB

I think you should be using something like this that checks if an
Excel application is running and opens one if not.

'------------------------------------------------------------
Dim xlApp As Object
On Error Resume Next
Set xlApp = GetObject(, "Excel.Application")
If Err.Number <> 0 Then 'Excel Not Active
Err.Clear
Set xlApp = CreateObject("Excel.Application")
End If
'--------------------------------------------------------------

Regards
BrianB
=============================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top