ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Detect if Excel file is "read only"??? (https://www.excelbanter.com/excel-programming/440054-detect-if-excel-file-read-only.html)

Robert Crandal

Detect if Excel file is "read only"???
 
If I open an Excel file which someone is currently using, Excel
will display a caption in the title bar that says "read only". Excel
is probably telling me that the file is read only because another
user currently is using the file.

My question is, does Excel have a function (or can I create
my own) which returns TRUE if the file is "read only" or
FALSE otherwise??? I'm mostly interested in a function
that returns TRUE if Excel displays the "read only" caption due
to the file's state of being in use.

thank you



Gary Keramidas[_3_]

Detect if Excel file is "read only"???
 
if activeworkbook.ReadOnly = true then
'do something
else
'do something else
end if

--


Gary Keramidas
Excel 2003


"Robert Crandal" wrote in message
...
If I open an Excel file which someone is currently using, Excel
will display a caption in the title bar that says "read only". Excel
is probably telling me that the file is read only because another
user currently is using the file.

My question is, does Excel have a function (or can I create
my own) which returns TRUE if the file is "read only" or
FALSE otherwise??? I'm mostly interested in a function
that returns TRUE if Excel displays the "read only" caption due
to the file's state of being in use.

thank you




Barb Reinhardt

Detect if Excel file is "read only"???
 
I've put something in the "Workbook_Open" procedure in the "ThisWorkbook"
module to check to see if the workbook is read only. The only difference
is that I'd use
If ThisWorkbook.Readonly then
'Do something
Else
'Do something else
end if

That way you know immediately when you open the workbook that it's read
only. Of course, macros need to be enabled for this to work.
--
HTH,

Barb Reinhardt



"Robert Crandal" wrote:

If I open an Excel file which someone is currently using, Excel
will display a caption in the title bar that says "read only". Excel
is probably telling me that the file is read only because another
user currently is using the file.

My question is, does Excel have a function (or can I create
my own) which returns TRUE if the file is "read only" or
FALSE otherwise??? I'm mostly interested in a function
that returns TRUE if Excel displays the "read only" caption due
to the file's state of being in use.

thank you


.


Bill McMurray

Detect if Excel file is "read only"???
 
Robert,

I am just an old, gray-haired teacher. A very useful lesson for my
students is to learn self-instruction and not rely on others if it is not
necessary. In other words, it would behoove them to research information
themselves. It can be a powerful tool, especially today in the age of the
internet.

I have not responded before in this NG but I do frequent the threads so I
may learn more. What I have noticed with many of your questions is that the
answers are right at *your* fingertips but you rely on others to provide
them for you.

In this case, if you simply searched VBA help for "readonly", you would have
found "workbook.readonly property" which is exactly what Mr. Keramidas
provided you with. You could have had your answer in a matter of seconds
instead of minutes.

In addition, a Google search for
http://www.google.com/search?hl=en&s...qi =&aql=&oq=
resulted in the first hit http://support.microsoft.com/kb/153058

I hope you accept this advice (from a teacher of 42 years) in the manner
intended.

Bill

"Robert Crandal" wrote in message
...
If I open an Excel file which someone is currently using, Excel
will display a caption in the title bar that says "read only". Excel
is probably telling me that the file is read only because another
user currently is using the file.

My question is, does Excel have a function (or can I create
my own) which returns TRUE if the file is "read only" or
FALSE otherwise??? I'm mostly interested in a function
that returns TRUE if Excel displays the "read only" caption due
to the file's state of being in use.

thank you





Robert Crandal

Detect if Excel file is "read only"???
 
Hi Bill,

But, if nobody relied on you and merely used Google for
their information, then you would be out of a teaching job,
wouldn't you?? ;)

I'm just being a smart ass here, haha. No offense is intended
to ya! Thanks for the advice though.

Robert


"Bill McMurray" wrote in message
...
Robert,

I am just an old, gray-haired teacher. A very useful lesson for my
students is to learn self-instruction and not rely on others if it is not
necessary. In other words, it would behoove them to research information
themselves. It can be a powerful tool, especially today in the age of the
internet.

I have not responded before in this NG but I do frequent the threads so I
may learn more. What I have noticed with many of your questions is that
the answers are right at *your* fingertips but you rely on others to
provide them for you.

In this case, if you simply searched VBA help for "readonly", you would
have found "workbook.readonly property" which is exactly what Mr.
Keramidas provided you with. You could have had your answer in a matter
of seconds instead of minutes.

In addition, a Google search for
http://www.google.com/search?hl=en&s...qi =&aql=&oq=
resulted in the first hit http://support.microsoft.com/kb/153058

I hope you accept this advice (from a teacher of 42 years) in the manner
intended.



Bill McMurray

Detect if Excel file is "read only"???
 
Robert,

You're alright in my books.

The good news for teachers is that there are just some things you *can't*
learn through the internet.

Cheers from an old dinosaur.

Bill

"Robert Crandal" wrote in message
...
Hi Bill,

But, if nobody relied on you and merely used Google for
their information, then you would be out of a teaching job,
wouldn't you?? ;)

I'm just being a smart ass here, haha. No offense is intended
to ya! Thanks for the advice though.

Robert


"Bill McMurray" wrote in message
...
Robert,

I am just an old, gray-haired teacher. A very useful lesson for my
students is to learn self-instruction and not rely on others if it is not
necessary. In other words, it would behoove them to research information
themselves. It can be a powerful tool, especially today in the age of
the internet.

I have not responded before in this NG but I do frequent the threads so I
may learn more. What I have noticed with many of your questions is that
the answers are right at *your* fingertips but you rely on others to
provide them for you.

In this case, if you simply searched VBA help for "readonly", you would
have found "workbook.readonly property" which is exactly what Mr.
Keramidas provided you with. You could have had your answer in a matter
of seconds instead of minutes.

In addition, a Google search for
http://www.google.com/search?hl=en&s...qi =&aql=&oq=
resulted in the first hit http://support.microsoft.com/kb/153058

I hope you accept this advice (from a teacher of 42 years) in the manner
intended.





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

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