ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Skip Read-only message (https://www.excelbanter.com/excel-programming/387675-skip-read-only-message.html)

CV323

Skip Read-only message
 
I have a macro that will open a read-only file - is there a code so that the
pop-up "this file is a read-only file, etc." doesn't pop up?

Thank you

dq

Skip Read-only message
 
Set parameter 7 of the Open command to True to open read/write
Call Workbooks.Open("MyFile", , , , , , True)
or to simply surpress the message set Application.Displayalerts =
false
(don't forget to turn back on again)

DQ


Dave Peterson

Skip Read-only message
 
Take a look at VBA's help for Open and you'll see:

Opens a workbook.

expression.Open(FileName, UpdateLinks, ReadOnly, Format, Password,
WriteResPassword, IgnoreReadOnlyRecommended, Origin, Delimiter, Editable,
Notify, Converter, AddToMru, Local, CorruptLoad)

So you'd do:

dim wkbk as workbook
set wkbk = workbooks.open(filename:="C:\something.xls", readonly:=true)
....


CV323 wrote:

I have a macro that will open a read-only file - is there a code so that the
pop-up "this file is a read-only file, etc." doesn't pop up?

Thank you


--

Dave Peterson


All times are GMT +1. The time now is 08:51 AM.

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