ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Is workbook open? (https://www.excelbanter.com/excel-programming/305004-workbook-open.html)

ianripping[_80_]

Is workbook open?
 
Is there some simple code for :

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

--
Message posted from http://www.ExcelForum.com


Norman Jones

Is workbook open?
 
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


---
Regards,
Norman


"ianripping " wrote in message
...
Is there some simple code for :

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


---
Message posted from http://www.ExcelForum.com/




ianripping[_83_]

Is workbook open?
 
I tried this and get sub or function not define

--
Message posted from http://www.ExcelForum.com


Ron de Bruin

Is workbook open?
 
You need the function also

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


--
Regards Ron de Bruin
http://www.rondebruin.nl


"ianripping " wrote in message ...
I tried this and get sub or function not defined


---
Message posted from http://www.ExcelForum.com/




ianripping[_84_]

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

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 01:06 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com