View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Vasant Nanavati Vasant Nanavati is offline
external usenet poster
 
Posts: 1,080
Default Resume Next doesn't work in IsOpen function

What does "none of them work for me" mean?

--

Vasant

"Rob" wrote in message
...
I want to test if a workbook is open. I've found these suggestions, but

none of them work for me. Any ideas why?
Thanks
Rob

'I've tried:
Function IsOpen(BookName As String) As Boolean
On Error Resume Next
Set wb = Workbooks(BookName)
IsOpen = Not wb Is Nothing
End Function

'and:
Function IsOpen(BookName As String) As Boolean
On Error Resume Next
IsOpen = Not (Application.Workbooks(BookName) Is Nothing)
End Function

'and:
Function IsOpen(BookName As String) As Boolean
On Error Resume Next
IsOpen = Len(Workbooks(BookName).Name)
End Function