问题
I would like to write a VBA program that prints the name of all the userforms in a workbook.
For instance, if a workbook has a userform called frmHello. I just want to print UserForm: frmHello
Does anyone know which collection is about userforms, and how to find the name of a userform?
回答1:
This one works for me:
Dim c As Object
For Each c In ThisWorkbook.VBProject.VBComponents
If c.Type = 3 Then
MsgBox c.Name
End If
Next
来源:https://stackoverflow.com/questions/23547832/go-through-all-the-userforms-of-a-workbook