Sub SampleCode1() '
Dim VBComponent As Variant
For Each VBComponent In ThisWorkbook.VBProject.VBComponents
Debug.Print VBComponent.CodeModule
Debug.Print VBComponent.Type
Next
End Sub
type1→標準モジュール
2→クラスモジュール
3→フォーム
100→Documentモジュール
'Module1内のプロシージャ名を列挙する
Sub SampleCode2()
Dim TempProcName As String
Dim ProcNames As String
Dim i As Long
With ThisWorkbook.VBProject.VBComponents("Module1").CodeModule
For i = 1 To .CountOfLines
If TempProcName <> .ProcOfLine(i, 0) Then
TempProcName = .ProcOfLine(i, 0)
Debug.Print TempProcName
End If
Next i
End With
End Sub
0 件のコメント:
コメントを投稿