|
|
|
|
|
|
Excel
|
List All UserForm Names in Your Project
|
|
Ease of Use
|
Intermediate
|
Version tested with
|
2000/XP
|
Submitted by:
|
Zack Barresse
|
Description:
|
This will display in a message box all Userforms names currently in a project.
|
Discussion:
|
You might use this as a reference utility while you code a project. It instantly displays in a message box list all the names you have assigned to the userforms in your project.
|
Code:
|
instructions for use
|
Option Explicit
Sub ListForms()
Dim x As String
Dim vbc As VBIDE.VBComponent
For Each vbc In ThisWorkbook.VBProject.VBComponents
If vbc.Type = vbext_ct_MSForm Then
Debug.Print vbc.Name
x = x & vbCr & vbc.Name
End If
Next vbc
If x = "" Then
MsgBox "No UserForms created."
Exit Sub
End If
MsgBox x
End Sub
|
How to use:
|
- Copy the above code.
- Open any workbook.
- Press Alt + F11 to open the Visual Basic Editor (VBE).
- From the Menu, choose Insert-Module.
- Paste the code into the right-hand code window.
- Click Tools - References: In xl2000 and up enable "Microsoft Visual Basic For Applications Extensibility 5.3" (w/ version number); in xl97, enable "Microsoft Visual Basic For Applications Extensibility"
- Close the VBE, save the file if desired.
|
Test the code:
|
- Tools-Macro-Macros, and double-click ListForms.
|
Sample File:
|
ListForms.zip 9.61KB
|
Approved by mdmackillop
|
This entry has been viewed 192 times.
|
|