Article ID: 151336
Article Last Modified on 10/10/2006
Sub Test()
If IsOpen("Book1.xls") Then
MsgBox "The file is open."
Else
MsgBox "The file is not open."
End If
End Sub
Function IsOpen(FileName As String) As Boolean
Dim wb As Workbook
For Each wb In Application.Workbooks
If UCase(wb.Name) = UCase(FileName) Then
IsOpen = True
Exit Function
End If
Next wb
IsOpen = False
End Function
In the above example, the IsOpen function returns a True if Book1.xls is
already open in the current instance of Microsoft Excel; otherwise, IsOpen
returns False.
Additional query words: 5.00a 5.00c 8.00 XL97 XL
Keywords: kbdtacode kbhowto kbprogramming KB151336