Printing Form Component information

  • Thread starter Thread starter DavidP
  • Start date Start date
D

DavidP

I am creating a form which will have quite a few components, frames, option buttons, Command boxees etc. When I have done similar things in VB it was easy to
print an inventory of the module with all the relevant details of the components. e.g. for option buttons you could see the names, height, width, top, font
etc. Can this be done with excel VBa.
I haven't a clue how to start but I assume it would have to be a macro. If this is the case could someone give me a starter outline please. I don't mind if
the info is on a created excel sheet or on to a new print file. Ideally for every component in my user form I would like to print say the height, width and top
for starters. If someone could start me on that I think I should be able to work out the rest for other properties

Thanks

DavidP
 
DavidP

Sub ListControls()

Dim ctl As Control

For Each ctl in Userform1.Controls
Debug.Pring ctl.Name, ctl.Top, ctl.Width, etc...
Next ctl

End Sub

--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.

DavidP said:
I am creating a form which will have quite a few components, frames,
option buttons, Command boxees etc. When I have done similar things in VB
it was easy to
print an inventory of the module with all the relevant details of the
components. e.g. for option buttons you could see the names, height, width,
top, font
etc. Can this be done with excel VBa.
I haven't a clue how to start but I assume it would have to be a macro.
If this is the case could someone give me a starter outline please. I don't
mind if
the info is on a created excel sheet or on to a new print file. Ideally
for every component in my user form I would like to print say the height,
width and top
for starters. If someone could start me on that I think I should be able
to work out the rest for other properties
 
Paste this code in a standard module and point it to your userform.

Sub UserformDoc()
For Each Control In UserForm1.Controls
With Control
Debug.Print .Name
Debug.Print .Top
Debug.Print .Left
Debug.Print .Height
Debug.Print .Width
End With
Next
End Sub



DavidP said:
I am creating a form which will have quite a few components, frames,
option buttons, Command boxees etc. When I have done similar things in VB
it was easy to
print an inventory of the module with all the relevant details of the
components. e.g. for option buttons you could see the names, height, width,
top, font
etc. Can this be done with excel VBa.
I haven't a clue how to start but I assume it would have to be a macro.
If this is the case could someone give me a starter outline please. I don't
mind if
the info is on a created excel sheet or on to a new print file. Ideally
for every component in my user form I would like to print say the height,
width and top
for starters. If someone could start me on that I think I should be able
to work out the rest for other properties
 
Back
Top