ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to tell if xls is open? (https://www.excelbanter.com/excel-programming/395310-how-tell-if-xls-open.html)

c mateland

How to tell if xls is open?
 
(Excel 2003)

I've seen information on this but still confused.

On a company network, I have Master.xls in a folder accessable by many
users.

Another workbook, Slave.xls, uses VBA to open Master.xls from the
network.

I want ...

a) ...Master.xls to open editable if NOT currently opened editable by
other users.
(Users having it open as read-only is irrelevant.)

b) ...to run other code if Master.xls IS currently opened editable by
another user.
(Users having it open as read-only is irrelevant.)

I've seen some code that first checks if the file is open. Is there
any way to perform this check by simply trying to open the file (as in
my scenario above)? I'm afraid in the split second between checking
and opening, another user might open it.

Also, I'm not sure if the other code I found was applicable on a
network with many users. It sounded more like it was being used on an
local machine and checking if a file was open in their session of
Excel.

Thanks in advance if anyone can get me started.

-Chuck


Tom Ogilvy

How to tell if xls is open?
 

http://support.microsoft.com?kbid=138621
XL: Macro Code to Check Whether a File Is Already Open

http://support.microsoft.com?kbid=291295
XL2002: Macro Code to Check Whether a File Is Already Open

http://support.microsoft.com?kbid=213383
XL2000: Macro Code to Check Whether a File Is Already Open

http://support.microsoft.com?kbid=184982
WD97: VBA Function to Check If File or Document Is Open

I woudn't be overly concerned about a split second change of state.
This will work on a network.
--
Regards,
Tom Ogilvy


"c mateland" wrote:

(Excel 2003)

I've seen information on this but still confused.

On a company network, I have Master.xls in a folder accessable by many
users.

Another workbook, Slave.xls, uses VBA to open Master.xls from the
network.

I want ...

a) ...Master.xls to open editable if NOT currently opened editable by
other users.
(Users having it open as read-only is irrelevant.)

b) ...to run other code if Master.xls IS currently opened editable by
another user.
(Users having it open as read-only is irrelevant.)

I've seen some code that first checks if the file is open. Is there
any way to perform this check by simply trying to open the file (as in
my scenario above)? I'm afraid in the split second between checking
and opening, another user might open it.

Also, I'm not sure if the other code I found was applicable on a
network with many users. It sounded more like it was being used on an
local machine and checking if a file was open in their session of
Excel.

Thanks in advance if anyone can get me started.

-Chuck



c mateland

How to tell if xls is open?
 
Thanks a bunch, Tom! I re-read the code and it makes more sense now.
Still it's good to hear you say it works. <g

-Chuck

On Aug 11, 4:52 pm, Tom Ogilvy
wrote:
http://support.microsoft.com?kbid=138621
XL: Macro Code to Check Whether a File Is Already Open

http://support.microsoft.com?kbid=291295
XL2002: Macro Code to Check Whether a File Is Already Open

http://support.microsoft.com?kbid=213383
XL2000: Macro Code to Check Whether a File Is Already Open

http://support.microsoft.com?kbid=184982
WD97: VBA Function to Check If File or Document Is Open

I woudn't be overly concerned about a split second change of state.
This will work on a network.
--
Regards,
Tom Ogilvy



"c mateland" wrote:
(Excel 2003)


I've seen information on this but still confused.


On a company network, I have Master.xls in a folder accessable by many
users.


Another workbook, Slave.xls, uses VBA to open Master.xls from the
network.


I want ...


a) ...Master.xls to open editable if NOT currently opened editable by
other users.
(Users having it open as read-only is irrelevant.)


b) ...to run other code if Master.xls IS currently opened editable by
another user.
(Users having it open as read-only is irrelevant.)


I've seen some code that first checks if the file is open. Is there
any way to perform this check by simply trying to open the file (as in
my scenario above)? I'm afraid in the split second between checking
and opening, another user might open it.


Also, I'm not sure if the other code I found was applicable on a
network with many users. It sounded more like it was being used on an
local machine and checking if a file was open in their session of
Excel.


Thanks in advance if anyone can get me started.


-Chuck- Hide quoted text -


- Show quoted text -





All times are GMT +1. The time now is 11:28 PM.

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