userforms

  • Thread starter Thread starter Fretsa
  • Start date Start date
Is there a way to use code to remove userforms in a
workbook?

See comments at start of following Sub.

HTH,
Merjet

Sub DeleteUserForms()
' 1. need to check "Microsoft Visual Basic For Applications
' Extensibility 5.3" at VBE menu Tools | References
' 2. need to check next "Trust access to Visual Basic Project"
' at Excel menu Tools | Macro | Security | Trusted Sources

Dim VBComp As VBIDE.VBComponent
Dim VBComps As VBIDE.VBComponents

Set VBComps = ThisWorkbook.VBProject.VBComponents

For Each VBComp In VBComps
If VBComp.Type = vbext_ct_MSForm Then VBComps.Remove VBComp
Next VBComp

End Sub
 

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

Back
Top