P
PJ Usher
I am transfering data from a Word 2000 document to an Excel 2000
spreadsheet. I have code, listed below, to check if the Excel spreadsheet
is open. (I modified code written by Ron de Briun)
The way this is written gives me "the file is open" whether the file is open
or not. I'm not sure how to fix this. Any help or pointers will be greatly
appreciated. Thank you.
PJ
Public Function IsOpen(FileName As String) As Boolean
On Error Resume Next
IsOpen = Not (excel.Application.workbooks(FileName) Is Nothing)
End Function
Sub Test( )
If IsOpen("test.xls") Then
MsgBox "the file is open"
Else
MsgBox "the file is not opened"
End If
End Sub
spreadsheet. I have code, listed below, to check if the Excel spreadsheet
is open. (I modified code written by Ron de Briun)
The way this is written gives me "the file is open" whether the file is open
or not. I'm not sure how to fix this. Any help or pointers will be greatly
appreciated. Thank you.
PJ
Public Function IsOpen(FileName As String) As Boolean
On Error Resume Next
IsOpen = Not (excel.Application.workbooks(FileName) Is Nothing)
End Function
Sub Test( )
If IsOpen("test.xls") Then
MsgBox "the file is open"
Else
MsgBox "the file is not opened"
End If
End Sub