Printing the Properties of an Object

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is it possible to print the properties of a selected object (text box, form,
form header, etc.)?
 
Posse John said:
Is it possible to print the properties of a selected object (text box,
form,
form header, etc.)?


Nothing built in, but you can do it with a little code ...

Public Sub PrintProps(ByVal obj As Object)

Dim intFile As Integer
Dim prps As Properties
Dim prp As Property

intFile = FreeFile
Open CurrentProject.Path & "\props.txt" For Output As #intFile
Set prps = obj.Properties

'because some properties may not be available or may not be printable
On Error Resume Next

For Each prp In prps
Print #intFile, prp.Name, prp.Value
Next prp
On Error GoTo 0
Close #intFile

End Sub

Examples of use in the Immediate window ....

printprops forms("fsfrCustomView")
printprops forms("fsfrCustomView").Controls("CancelledDate")

The first example will list all the properties of the form (open the form in
design view before running this code) and the second example will list all
of the properties of the control named 'CancelledDate'.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top