Is workbook open?

I

ianripping

Is there some simple code for :

If workbook E:\temp.xls is already open by another user the
msgbox("Open Already") else _ continue....
 
N

Norman Jones

Hi Ian,

Several ways. Here is a routine posted by John Green:

Sub IsWorkBookOpenDemo()
If IsWorkBookOpen("a.xls") = False Then Workbooks.Open "C:\a.xls"
If IsWorkBookOpen("b.xls") = False Then Workbooks.Open "C:\b.xls"
If IsWorkBookOpen("c.xls") = False Then Workbooks.Open "C:\c.xls"
End Sub
 
R

Ron de Bruin

You need the function also

Function IsWorkBookOpen(sWB)
On Error GoTo NotOpen
Workbooks(sWB).Activate
IsWorkBookOpen = True
Exit Function
NotOpen:
IsWorkBookOpen = False
End Function
 
I

ianripping

I have tried this but I get the message back that the workbook isn'
open when it is on another network PC!
 
Top