Is file opened?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How can I see if an Excel file is already opened

Because when it is I can't save a new one with the same name

Many thx in advanc

DonaldVdD
 
--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Donald,

Here is a simple function you can use

Function IsFileOpen(wb As String)
Dim oWb As Workbook

On Error Resume Next
Set oWb = Workbooks(wb)
On Error GoTo 0
IsFileOpen = Not oWb Is Nothing
End Function

Works like this

MsgBox IsFileOpen("Premiership 2003.xls")

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Back
Top