Hi PJ
I don't look at the article.(you don't need a loop)
Use this function in a normal module
Function bIsBookOpen(ByRef szBookName As String) As Boolean
' Rob Bovey
On Error Resume Next
bIsBookOpen = Not (Application.Workbooks(szBookName) Is Nothing)
End Function
Sub File_Open_test()
If bIsBookOpen("Test.xls") Then
MsgBox "the File is open!"
Else
MsgBox "the File is not open!"
End If
End Sub
--
Regards Ron de Bruin
http://www.rondebruin.nl
"PJ Usher" wrote in message ...
I followed Microsoft Knowledge Base Article 213299 XL2000: For Each Loop to
Determine If an Excel Workbook is Open
When I run the code the line
Dim wb as Workbook
is highlighted and I receive an error
Compile error: User-defined type not defined
?????
The code is written exactly as written in the article. Can I fix this?
Thanks for any help
PJ