Matthew,
You can use a function like
Public Function IsWorkbookOpen(WorkbookName As String) As Boolean
On Error Resume Next
IsWorkbookOpen = _
CBool(Len(Application.Workbooks(WorkbookName).Name))
End Function
Then, you'd call the function in code like the following:
Sub AAA()
Dim Res As Boolean
Res = IsWorkbookOpen("Worksheet in basis.xls")
If Res = True Then
'''''''''''''''''''''''''''
' code for workbook is open
'''''''''''''''''''''''''''
Else
'''''''''''''''''''''''''''''''
' code for workbook is not open
'''''''''''''''''''''''''''''''
End If
End Sub
Note that the workbook name must include the ".xls" extension in the name.
E.g.,
"Worksheet in basis.xls"
and NOT
"Worksheet in basis"
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
www.cpearson.com
(email address is on the web site)
"Matthew Balch" <(E-Mail Removed)> wrote in message
news:0FE895FF-E3CA-4295-BDDD-(E-Mail Removed)...
> 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