ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Check if an Excel or Word file is "read only"???? (https://www.excelbanter.com/excel-programming/443469-check-if-excel-word-file-read-only.html)

Robert Crandal[_2_]

Check if an Excel or Word file is "read only"????
 
Are there any VBA functions I can call from an Excel file that
will help me determine if a particular Excel 2007 or Word 2007
is currently in "read only" status? In other words, I need to
test if an Excel or Word file is opened or in use by another user??

I would like to know any or all methods to achieve this.

Thank you everyone!

Robert





Harald Staff[_2_]

Check if an Excel or Word file is "read only"????
 
Hi Robert

Sub test()
MsgBox ActiveWorkbook.ReadOnly
MsgBox ActiveWorkbook.WriteReserved
MsgBox ActiveWorkbook.WriteReservedBy
End Sub

This needs the file to be open. If you want to see if a file is in use
before opening it, there is usually a similarly named temp file in the same
folder if someone else uses the file. Test opening and closing with a file
explorer window open.

Best wishes Harald

"Robert Crandal" wrote in message
...
Are there any VBA functions I can call from an Excel file that
will help me determine if a particular Excel 2007 or Word 2007
is currently in "read only" status? In other words, I need to
test if an Excel or Word file is opened or in use by another user??

I would like to know any or all methods to achieve this.

Thank you everyone!

Robert






Robert Crandal[_2_]

Check if an Excel or Word file is "read only"????
 
Do you know how to check the read only status on a
file that is NOT the ActiveWorkbook? For example,
I will be using a file named "mydata.xlsm". While using
this file, I want to run a macro to test whether a file named
"groupdata.xlsm" is open or being used by another user.

Also, if I want to see if a file is in use BEFORE opening it,
does that mean I need to check for the presence of a hidden
temp file in the same folder with a similar name? Is there a
reliable VBA function for this?

Thank you Harald!



"Harald Staff" wrote in message
. ..
Hi Robert

Sub test()
MsgBox ActiveWorkbook.ReadOnly
MsgBox ActiveWorkbook.WriteReserved
MsgBox ActiveWorkbook.WriteReservedBy
End Sub

This needs the file to be open. If you want to see if a file is in use
before opening it, there is usually a similarly named temp file in the
same folder if someone else uses the file. Test opening and closing with a
file explorer window open.



ManicMiner17

Check if an Excel or Word file is "read only"????
 
On 07/08/2010 13:24, Robert Crandal wrote:

Might be worth looking at:
http://www.vbaexpress.com/kb/getarticle.php?kb_id=468



Harald Staff[_2_]

Check if an Excel or Word file is "read only"????
 

MsgBox Workbooks("mydata.xlsm").ReadOnly
'and so on

and Yes, and No, not to my knowledge, you must write it.

Best wishes Harald

"Robert Crandal" wrote in message
...
Do you know how to check the read only status on a
file that is NOT the ActiveWorkbook? For example,
I will be using a file named "mydata.xlsm". While using
this file, I want to run a macro to test whether a file named
"groupdata.xlsm" is open or being used by another user.

Also, if I want to see if a file is in use BEFORE opening it,
does that mean I need to check for the presence of a hidden
temp file in the same folder with a similar name? Is there a
reliable VBA function for this?

Thank you Harald!



"Harald Staff" wrote in message
. ..
Hi Robert

Sub test()
MsgBox ActiveWorkbook.ReadOnly
MsgBox ActiveWorkbook.WriteReserved
MsgBox ActiveWorkbook.WriteReservedBy
End Sub

This needs the file to be open. If you want to see if a file is in use
before opening it, there is usually a similarly named temp file in the
same folder if someone else uses the file. Test opening and closing with
a file explorer window open.




Mike S[_5_]

Check if an Excel or Word file is "read only"????
 
On 8/7/2010 7:31 AM, Harald Staff wrote:

MsgBox Workbooks("mydata.xlsm").ReadOnly
'and so on

and Yes, and No, not to my knowledge, you must write it.

Best wishes Harald

"Robert Crandal" wrote in message
...
Do you know how to check the read only status on a
file that is NOT the ActiveWorkbook? For example,
I will be using a file named "mydata.xlsm". While using
this file, I want to run a macro to test whether a file named
"groupdata.xlsm" is open or being used by another user.

Also, if I want to see if a file is in use BEFORE opening it,
does that mean I need to check for the presence of a hidden
temp file in the same folder with a similar name? Is there a
reliable VBA function for this?

Thank you Harald!



"Harald Staff" wrote in message
. ..
Hi Robert

Sub test()
MsgBox ActiveWorkbook.ReadOnly
MsgBox ActiveWorkbook.WriteReserved
MsgBox ActiveWorkbook.WriteReservedBy
End Sub

This needs the file to be open. If you want to see if a file is in
use before opening it, there is usually a similarly named temp file
in the same folder if someone else uses the file. Test opening and
closing with a file explorer window open.


How about this approach?

http://support.microsoft.com/kb/153058


All times are GMT +1. The time now is 12:21 PM.

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