ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Checking if another workbook is open (https://www.excelbanter.com/excel-programming/377393-re-checking-if-another-workbook-open.html)

Vijay Kotian

Checking if another workbook is open
 
Hi
I tried to use the code given by you. I am getting error message run time
error '9' subscript out of range.. can you please help me out.

Regards
Vijay Kotian

"Bob Phillips" wrote:

On Error Resume Next
Set oWB = Workbooks(Filename:="Worksheet in basis.xls")
On Error Goto 0
If oWB Is Nothing Then
MsgBox "Workbook not open"
Exit Sub
End If

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"Matthew Balch" wrote in message
...
Hi,

I have a mcro that extracts data from another workbook which is created

from
a download of another application.

How do I in VB write it to check to see if this download is available. The
workbook I need to check to see if it is open in the application is called
'Worksheet in basis'.
If not available then will simply cancel the macro and prompt the user to
extract the data accordingly.

Thanks in advance
Matthew Balch





Dave Peterson

Checking if another workbook is open
 
You changed part of the code.

Either copy Bob's response and try again or post your current code.

Vijay Kotian wrote:

Hi
I tried to use the code given by you. I am getting error message run time
error '9' subscript out of range.. can you please help me out.

Regards
Vijay Kotian

"Bob Phillips" wrote:

On Error Resume Next
Set oWB = Workbooks(Filename:="Worksheet in basis.xls")
On Error Goto 0
If oWB Is Nothing Then
MsgBox "Workbook not open"
Exit Sub
End If

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"Matthew Balch" wrote in message
...
Hi,

I have a mcro that extracts data from another workbook which is created

from
a download of another application.

How do I in VB write it to check to see if this download is available. The
workbook I need to check to see if it is open in the application is called
'Worksheet in basis'.
If not available then will simply cancel the macro and prompt the user to
extract the data accordingly.

Thanks in advance
Matthew Balch





--

Dave Peterson


All times are GMT +1. The time now is 07:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com