Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 158
Default 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




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 449
Default 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





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 158
Default 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.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default 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


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 449
Default 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.





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 86
Default 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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Check if cells contain the word "Thailand", return "TRUE" ali Excel Worksheet Functions 7 September 14th 07 09:53 AM
"Unable to Read File" error message in Excel - solutions? Presby Loaner Excel Discussion (Misc queries) 2 June 27th 07 05:09 PM
"Cannot access read-only document" (I get this error when I try to open an Excel file) [email protected] Excel Discussion (Misc queries) 1 June 5th 06 01:15 PM
"Cannot access read-only document" (I get this error when I try to open an Excel file) [email protected] Setting up and Configuration of Excel 1 June 5th 06 01:15 PM


All times are GMT +1. The time now is 02:13 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"