Auto delete all VB forms in current excel doc

M

Martin

Not sure if this will be possible, but I'm trying to put
together some code which removes all Vis Basic Forms from
the current excel document without having to go into the
visual basic editor.

Thanks
 
C

Chip Pearson

Martin,

Set a reference in VBA to the MS VBA Extensibility library, and then use the
following code:

Dim VBComp As VBIDE.VBComponent
With ActiveWorkbook.VBProject
For Each VBComp In .VBComponents
If VBComp.Type = vbext_ct_MSForm Then
.VBComponents.Remove VBComp
End If
Next VBComp
End With


See www.cpearson.com/excel/vbe.htm for more details.
 

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