View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Michel Pierron Michel Pierron is offline
external usenet poster
 
Posts: 214
Default Viewing UserForm code in Notepad

Re Paul,
For all controls properties, if you have the possibility of adding the
reference to TypeLibInformation (c:\windows\system32\tlbinf32.dll), adapt
the following code to your need:

Sub ControlsPropertiesList()
If UserForm1.Controls.Count = 0 Then Exit Sub
Cells.ClearContents
Dim oInfo As InterfaceInfo
Dim oMember As MemberInfo
Dim sProp$, i&, sVal$, Ctl As Control
For Each Ctl In UserForm1.Controls
i = i + 1
Set oInfo = InterfaceInfoFromObject(Ctl)
For Each oMember In oInfo.Members
On Error Resume Next
If oMember.InvokeKind = 4 Then
sProp = oMember.Name
sVal = CallByName(Ctl, sProp, VbGet)
Cells(i, 1) = oInfo.Name
Cells(i, 2) = sProp
Cells(i, 3) = sVal
i = i + 1
End If
Next oMember
Next Ctl
Cells.Columns.AutoFit
End Sub

Regards,
MP

"Paul Martin" a écrit dans le message de news:
...
Hi all

If I export a Form Module to my desktop and open it in Notepad, I can
see how VBA writes the properties of the UserForm such as Height, Left,
StartUpPosition, etc.

Is there any way that I can (in Notepad) also view all the properties
of all the controls on the UserForm?

Thanks in advance

Paul Martin
Melbourne, Australia