Hi,
I'm writing a macro that tests to see if an Excel file is currently open.
I've tried the following with no luck:
if Excel.application.workbooks(File).open = true then
...
end if
Any ideas?
Thanks,
Jille
Perry - 05 Feb 2007 01:34 GMT
Utilize below/bottom examplified function as in below immediate window
quest:
? fileisopen("c:\data\ta\ta\ta\myfile.xls")
False
'= VBA function outlay
Function FileIsOpen(ByVal FileName As String) As Boolean
Dim i As Integer
i = FreeFile
On Error GoTo ErrOpenFile
Open FileName For Binary Access Read Lock Read As #i
Close #i
FileIsOpen = True
ExitHere:
Exit Function
ErrOpenFile:
Resume ExitHere
End Function
Krgrds,
Perry
> Hi,
>
[quoted text clipped - 9 lines]
> Thanks,
> Jille