File Open

  • Thread starter Thread starter Mili
  • Start date Start date
M

Mili

Hi,
How to check if the a perticular file is open or not ?
How to display true if the file is open.

Thanks

Regards

Mili.
 
Hi Mili

Function IsOpen(WbName As String) As Boolean
On Error Resume Next
IsOpen = Len(Workbooks(WbName).Name)
End Function

Sub test()
MsgBox IsOpen("Book1")
MsgBox IsOpen("MyPornArchive")
End Sub
 
Hi,

I am trying to test any file not only workbook.
any text file, or word file.

Thanks

Regards

Mili.
 
That is somewhere between far worse and impossible. Especially for textfiles
and alike, they are not "open" as we know the word. Most apps, like notepad,
just read them and dump its content into a text field. Try opening a
textfile in Notepad, and then move it to some other folder with Windows
Explorer.
 
Back
Top