ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   read vs write file (https://www.excelbanter.com/excel-programming/436552-read-vs-write-file.html)

Alberto Ast[_2_]

read vs write file
 
If I open a file with macros... it could had been opened as read only or as
read/write....

Then how do I check with a macro if it was opened as read only or as
read/write?

Peter T

read vs write file
 
bReadOnly = wb.ReadOnly

where wb refers to the workbook you want to know about

Regards,
Peter T

"Alberto Ast" wrote in message
...
If I open a file with macros... it could had been opened as read only or
as
read/write....

Then how do I check with a macro if it was opened as read only or as
read/write?




Alberto Ast[_2_]

read vs write file
 
Will the statement read as follows?

if wb.ReadOnly then
wb.Close False
else
wb.Close True
end if

"Peter T" wrote:

bReadOnly = wb.ReadOnly

where wb refers to the workbook you want to know about

Regards,
Peter T

"Alberto Ast" wrote in message
...
If I open a file with macros... it could had been opened as read only or
as
read/write....

Then how do I check with a macro if it was opened as read only or as
read/write?



.


Jacob Skaria

read vs write file
 
Yes..provided you have the wb object...

Dim wb as workbook
Set wb = ActiveWorkbook

If this post helps click Yes
---------------
Jacob Skaria


"Alberto Ast" wrote:

Will the statement read as follows?

if wb.ReadOnly then
wb.Close False
else
wb.Close True
end if

"Peter T" wrote:

bReadOnly = wb.ReadOnly

where wb refers to the workbook you want to know about

Regards,
Peter T

"Alberto Ast" wrote in message
...
If I open a file with macros... it could had been opened as read only or
as
read/write....

Then how do I check with a macro if it was opened as read only or as
read/write?



.



All times are GMT +1. The time now is 11:17 AM.

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