ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Read only (https://www.excelbanter.com/excel-programming/296484-read-only.html)

tim

Read only
 
Hello All,

I would like to open a read-only file, update a query,
make the file NOT read-only, save with the updated query,
then make read-only again.

I have the code to do the updates etc. Just not sure if
I can somehow temporarily make the workbook Un read-only.

Thanks

Michel Pierron

Read only
 
Hi Tim;
For example:

Sub WbkAcces()
With ThisWorkbook
If GetAttr(.FullName) And vbReadOnly Then SetAttr .FullName, vbNormal
If .ReadOnly Then .ChangeFileAccess xlReadWrite
End If
End With
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
SetAttr ThisWorkbook.FullName, vbReadOnly
End Sub

MP

"Tim" a écrit dans le message de
...
Hello All,

I would like to open a read-only file, update a query,
make the file NOT read-only, save with the updated query,
then make read-only again.

I have the code to do the updates etc. Just not sure if
I can somehow temporarily make the workbook Un read-only.

Thanks





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

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