How to disable activex controls & code on saving a new workbook.XL2003

G

Guv

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.
 
D

Dave Peterson

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.Enabled = False
'or
ThisWorkbook.Worksheets("sheet1").CommandButton1.Visible = False
'or
ThisWorkbook.Worksheets("sheet1").CommandButton1.Cut
 
G

Guv

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.
 
D

Dave Peterson

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
 

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

Top