willyboy58
Technical User
I looked thru past posts and did not find anything to match my questions below.
I have a procedure that uses info from different workbooks. I want to check if a particular workbook is opened or not. If not, then open it. If it is already open, do not open it again or tell me that it is already opened. I have the following code:
Sub IsProp1InvoiceOpen()
If Workbooks.Open("C:\MSOffice\Excel\WorkStuff\Prop1Invoice.xls"
= False Then
Workbooks.Open Filename:="C:\MSOffice\Excel\Work Stuff\Prop1Invoice.xls"
Else ‘workbook is already open
Exit Sub ‘exit this sub and go to the next one
End If
End Sub
When I run the above procedure, I receive the error message “Object doesn’t support this property or method.” It doesn’t matter if the desired workbook is opened or not, I still get the message. Why?
Also, how can I avoid the message “This workbook contains automatic links…..” and the message “Prop1Invoice.xls is already open. …..” when the workbook is already opened?
TIA
Bill
I have a procedure that uses info from different workbooks. I want to check if a particular workbook is opened or not. If not, then open it. If it is already open, do not open it again or tell me that it is already opened. I have the following code:
Sub IsProp1InvoiceOpen()
If Workbooks.Open("C:\MSOffice\Excel\WorkStuff\Prop1Invoice.xls"
Workbooks.Open Filename:="C:\MSOffice\Excel\Work Stuff\Prop1Invoice.xls"
Else ‘workbook is already open
Exit Sub ‘exit this sub and go to the next one
End If
End Sub
When I run the above procedure, I receive the error message “Object doesn’t support this property or method.” It doesn’t matter if the desired workbook is opened or not, I still get the message. Why?
Also, how can I avoid the message “This workbook contains automatic links…..” and the message “Prop1Invoice.xls is already open. …..” when the workbook is already opened?
TIA
Bill