![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Guest
Posts: n/a
|
Is it possible to force excel to disable all macro's or all form buttons when a workbook is opened as read only?
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Bogota, Colombia
Posts: 11,927
|
I don't think so, but, you could add a condition at the beginning of your code to test if the workbook is read only, and if it is, Exit Sub.
If ActiveWorkbook.ReadOnly then Exit Sub |
|
|
|
|
|
#3 |
|
New Member
Join Date: Feb 2002
Posts: 11
|
Unless someone has a better suggestions - I would just insert the following code at the start of your routines.
If ActiveWorkbook.ReadOnly Then exit sub End If If you have a lot of routines then I would suggest you create an xla file with all thes processes etc which is called by the workbook - in that case you would load the xla only if the file was not a read-only file as in the following example. If ActiveWorkbook.ReadOnly Then exit sub else Workbooks.Open FileName:="my_xla_file.xla" End If Hope this helps. John |
|
|
|
|
|
#4 |
|
Guest
Posts: n/a
|
That worked great! Thanks.
Erik |
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|