Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Listing Application Userform Contents
I have an application with a number of user froms with many different
controls on each. I wish to list all userform controls, names and captions on a new sheet. Further for each userform list and group the control types I have looked at the Userforms collection and Controls collection but not established the best method to extract and organise the controls by type etc. Does anyone know of a utility to do this? Thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Listing Application Userform Contents
Hi Nigel,
You can try: Sub UserFormsProperties() Dim i%, u%, y%, obj As Object Application.ScreenUpdating = False Workbooks.Add With ThisWorkbook.VBProject For Each obj In .VBComponents If obj.Type = 3 Then y = y + 1 Cells(1, y) = obj.Name Cells(1, y).Font.Bold = True For i = 1 To obj.Properties.Count On Error Resume Next Cells(i + 1, y) = obj.Properties(i).Name Cells(i + 1, y + 1) = obj.Properties(i).Value Next i Call ControlsProperties(obj, i + 1, y) y = y + 3 End If Next obj End With Cells.Columns.AutoFit End Sub ' Need reference to TypLib Information ' C:\Windows\System32\Tlbinf32.dll Private Sub ControlsProperties(obj As Object, ByVal i%, ByVal y%) Dim oMember As MemberInfo Dim sProp$, sVal$, Ctl As Control For Each Ctl In obj.Designer.Controls i = i + 1 Cells(i, y) = Ctl.Name Cells(i, y).Font.Bold = True 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, y) = oInfo.Name Cells(i, y + 1) = sProp Cells(i, y + 2) = sVal i = i + 1 End If Next oMember Next Ctl End Sub Regards, MP "Nigel RS" a écrit dans le message de news: ... I have an application with a number of user froms with many different controls on each. I wish to list all userform controls, names and captions on a new sheet. Further for each userform list and group the control types I have looked at the Userforms collection and Controls collection but not established the best method to extract and organise the controls by type etc. Does anyone know of a utility to do this? Thanks |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Listing Application Userform Contents
Many thanks. works ok
-- Cheers Nigel "Michel Pierron" wrote in message ... Hi Nigel, You can try: Sub UserFormsProperties() Dim i%, u%, y%, obj As Object Application.ScreenUpdating = False Workbooks.Add With ThisWorkbook.VBProject For Each obj In .VBComponents If obj.Type = 3 Then y = y + 1 Cells(1, y) = obj.Name Cells(1, y).Font.Bold = True For i = 1 To obj.Properties.Count On Error Resume Next Cells(i + 1, y) = obj.Properties(i).Name Cells(i + 1, y + 1) = obj.Properties(i).Value Next i Call ControlsProperties(obj, i + 1, y) y = y + 3 End If Next obj End With Cells.Columns.AutoFit End Sub ' Need reference to TypLib Information ' C:\Windows\System32\Tlbinf32.dll Private Sub ControlsProperties(obj As Object, ByVal i%, ByVal y%) Dim oMember As MemberInfo Dim sProp$, sVal$, Ctl As Control For Each Ctl In obj.Designer.Controls i = i + 1 Cells(i, y) = Ctl.Name Cells(i, y).Font.Bold = True 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, y) = oInfo.Name Cells(i, y + 1) = sProp Cells(i, y + 2) = sVal i = i + 1 End If Next oMember Next Ctl End Sub Regards, MP "Nigel RS" a écrit dans le message de news: ... I have an application with a number of user froms with many different controls on each. I wish to list all userform controls, names and captions on a new sheet. Further for each userform list and group the control types I have looked at the Userforms collection and Controls collection but not established the best method to extract and organise the controls by type etc. Does anyone know of a utility to do this? Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Listing Folder Contents into a Column | Excel Worksheet Functions | |||
Listing the contents of a folder | Excel Discussion (Misc queries) | |||
Listing of contents within CHM file | Excel Programming | |||
Listing Directory Contents in Worksheet | Excel Discussion (Misc queries) | |||
Listing the contents of a directory in a spreadsheet | Excel Programming |