Read Only Issue

  • Thread starter Thread starter PJ Usher
  • Start date Start date
P

PJ Usher

Excel 2000

I'm trying to write a macro that will automatically update WorkbookB from
WorkbookA. I have it worked out - almost. The problem is that WorkbookB
has to have the Read-only checked in it's document property making saving
the document a little tricky.

In the macro I have
Workbooks.Open Filename:="WorkbookB.xls", Readonly=False
Thinking that it will open WorkbookB in ReadWrite Mode but it still open as
ReadnOnly.

Is there a way to change a workbook from read only, make document changes
then save document back with read-only, without changing document name?

Thank you

PJ
 
Hi there.

This is written in the reply, and therefore not tested, but hopefully
should work for you.

Dim wb as Workbook
Set wb = Workbooks.Open Filename:="WorkbookB.xls"

'Remove Read only status
SetAttr wb.FullName, vbNormal

'Do stuff here

'Make workbook read only
SetAttr wb.FullName, vbReadOnly

Set wb = Nothing

HTH,

Ken Puls, CMA - Microsoft MVP (Excel)
www.excelguru.ca
 
Hi Ken

I was able to use SetAttr to change the read only property. Thank you very
much for you help.

PJ
 

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

Back
Top