ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to disable activex controls & code on saving a new workbook.XL2003 (https://www.excelbanter.com/excel-programming/406599-how-disable-activex-controls-code-saving-new-workbook-xl2003.html)

Guv

How to disable activex controls & code on saving a new workbook.XL2003
 
Please can anyone help me?
I have created a form that uses activex controls and some code. The
form is then saved as a read only file and some cells in the range are
pasted as values.
I know the form is read only but I would like to disable the controls
and code purely to keep the read only "clean".
I am very green using VBA so any help would be appreciated.
Thanks, Guv.

Dave Peterson

How to disable activex controls & code on saving a new workbook.XL2003
 
If you're using code to do the copy|paste special|values and saveAs, maybe you
can add something to the code to disable, hide or delete the object.

Maybe something like one of these:

ThisWorkbook.Worksheets("sheet1").CommandButton1.E nabled = False
'or
ThisWorkbook.Worksheets("sheet1").CommandButton1.V isible = False
'or
ThisWorkbook.Worksheets("sheet1").CommandButton1.C ut



Guv wrote:

Please can anyone help me?
I have created a form that uses activex controls and some code. The
form is then saved as a read only file and some cells in the range are
pasted as values.
I know the form is read only but I would like to disable the controls
and code purely to keep the read only "clean".
I am very green using VBA so any help would be appreciated.
Thanks, Guv.


--

Dave Peterson

Guv

How to disable activex controls & code on saving a new workbook.XL2003
 
Thanks Dave, I have already done this, but I was hoping for one
procedure to disable all, as there are many controls etc.

Thanks, Guv.


Dave Peterson

How to disable activex controls & code on saving a new workbook.XL2003
 
Are there any OLEObjects that you want to keep active?

Maybe you could use a variation of:

dim OLEObj as OLEObject
for each oleobj in worksheets("sheet999").oleobjects
oleobj.object.enabled = false
next oleobj

Guv wrote:

Thanks Dave, I have already done this, but I was hoping for one
procedure to disable all, as there are many controls etc.

Thanks, Guv.


--

Dave Peterson


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

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