tacchini's manual

自分用のマニュアルを作成します。

Accessでコントロールとプロパティの一覧をVBAで出力

フォームのボタンに登録

Private Sub cmdListPropertiesAtContactForm_Click()
 ExportControlPropertiesToFile Me, "base"
End Sub

標準モジュールに登録

Public Sub ExportControlPropertiesToFile(ByRef frm As Form, fileName As String)
    Dim ctl As Control
    Dim prop As Property
    Dim f As Integer
    Dim outputPath As String
    
    outputPath = "C:\Tmp\control_properties." & fileName & ".md"
    f = FreeFile
    
    Open outputPath For Output As #f
    
    For Each ctl In frm.Controls
        Print #f, "## Control: " & ctl.name & " (" & ctl.ControlType & ")"
        On Error Resume Next
        For Each prop In ctl.Properties
            Print #f, "  " & prop.name & " = " & prop.Value
        Next
        On Error GoTo 0
        Print #f, ""
    Next
    
    Close #f
    
    MsgBox "完了しました: " & outputPath
End Sub