Lock workbook.

  • Thread starter Thread starter Tom
  • Start date Start date
T

Tom

Hello everybody,

I have two workbooks, in the first I have some Forms (for me its programs
workbook) and in the second I have datas.

Is there some way how can I lock (write) the data workbook only for
Macros-Forms. I dont want still open and close this workbook

Thanks
Tom
 
Tom,

I think you can do that. You can protect the sheets (each) in the Data
workbook (Tools, Protection, Protect Sheet). The Programs workbook can
either unprotect the sheet before any update, then re-protect it, or can
first issue something like:

Workbooks("Data.xls").Sheets("Sheet1").Protect UserinterfaceOnly:=True

The UserInterfaceOnly allows macros to update the sheet, but not the user
directly. The protection is remembered at the next opening, but the
UserInterfaceOnly part is not. So you must issue it again in. You can do
that in the Programs workbook, so that no macros need be enabled in the data
workbook.
 
Thank you very much
Tom

Earl Kiosterud said:
Tom,

I think you can do that. You can protect the sheets (each) in the Data
workbook (Tools, Protection, Protect Sheet). The Programs workbook can
either unprotect the sheet before any update, then re-protect it, or can
first issue something like:

Workbooks("Data.xls").Sheets("Sheet1").Protect UserinterfaceOnly:=True

The UserInterfaceOnly allows macros to update the sheet, but not the user
directly. The protection is remembered at the next opening, but the
UserInterfaceOnly part is not. So you must issue it again in. You can do
that in the Programs workbook, so that no macros need be enabled in the data
workbook.
 
Back
Top