Skip Read-only message

G

Guest

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
 
D

dq

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
 
D

Dave Peterson

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)
....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top