ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how do you open a file read-only? (https://www.excelbanter.com/excel-programming/330939-how-do-you-open-file-read-only.html)

Mark Seger

how do you open a file read-only?
 
Being pretty new to macro writing, my standard approach to everything is
to record bits and pieces of what I want to do in mini-macros and then
use that code to build up a more general one.

When I record a macro while opening a file read-only, nothing gets
captured that indicated it's read-only. Furthermore, if I execute the
macro it opens the file as writable.

Does this mean you can't write a macro to open a file read-only OR is
there a bug in excel in that it's not capturing that fact in 'record macro'?

-mark


dominicb[_15_]

how do you open a file read-only?
 

Good afternoon Mark

Try this

Workbooks.Open Filename:= "C:\TestFile.xls", ReadOnly:=True

The ReadOnly function does seem to be documented, but not to a great
extent. But it works.

HTH

DominicB


--
dominicb
------------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932
View this thread: http://www.excelforum.com/showthread...hreadid=376533



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

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