This post goes with "Commandbar-File Documentation Part I" posted earlier.
The module, procedure and worksheet code names list on a worksheet using this code.
How can I stop the sheet name listing, I only need the module and procedure title?<pre>Sub Macro_List_All_Subs_and_Functions()
Dim MasterVBComp As VBComponents
Dim SingleVBComp As VBComponent
Dim VBCodeMod As CodeModule
Dim LineCount As Integer
Dim LineNo As Integer
On Error GoTo AddSheetError
Sheets("fil-Macro List-3").Select
On Error GoTo 0
With Sheets("fil-Macro List-3").Cells
With Range("A2:B200")
.ClearContents
'.Clear ' this clears everything, text and formats
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
'.Columns.AutoFit
'.Rows.AutoFit
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
.Font.Name = "Arial"
.Font.Size = 8
.IndentLevel = 0
.Range("A1").Select
End With
End With
'Cells.Select
'Selection.Delete Shift:=xlUp ' I would like to know what this does
'Range("A1").Select
Set MasterVBComp = ThisWorkbook.VBProject.VBComponents
LineCount = 0
LineNo = 0
For Each SingleVBComp In MasterVBComp
LineNo = LineNo + 1
Worksheets("fil-Macro List-3").Cells(LineNo, 1).Value = SingleVBComp.Name
Set VBCodeMod = ThisWorkbook.VBProject.VBComponents(SingleVBComp.Name).CodeModule
With VBCodeMod
StartLine = .CountOfDeclarationLines + 1
Do Until StartLine >= .CountOfLines
LineNo = LineNo + 1
Worksheets("fil-Macro List-3").Cells(LineNo, 2).Value = .ProcOfLine(StartLine, vbext_pk_Proc)
'Msg = Msg & .ProcOfLine(StartLine, vbext_pk_Proc) & Chr(13)
StartLine = StartLine + .ProcCountLines(.ProcOfLine(StartLine, vbext_pk_Proc), vbext_pk_Proc)
Loop
End With
Next
Exit Sub</pre>
This message was edited by em on 2003-01-31 23:53
The module, procedure and worksheet code names list on a worksheet using this code.
How can I stop the sheet name listing, I only need the module and procedure title?<pre>Sub Macro_List_All_Subs_and_Functions()
Dim MasterVBComp As VBComponents
Dim SingleVBComp As VBComponent
Dim VBCodeMod As CodeModule
Dim LineCount As Integer
Dim LineNo As Integer
On Error GoTo AddSheetError
Sheets("fil-Macro List-3").Select
On Error GoTo 0
With Sheets("fil-Macro List-3").Cells
With Range("A2:B200")
.ClearContents
'.Clear ' this clears everything, text and formats
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
'.Columns.AutoFit
'.Rows.AutoFit
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
.Font.Name = "Arial"
.Font.Size = 8
.IndentLevel = 0
.Range("A1").Select
End With
End With
'Cells.Select
'Selection.Delete Shift:=xlUp ' I would like to know what this does
'Range("A1").Select
Set MasterVBComp = ThisWorkbook.VBProject.VBComponents
LineCount = 0
LineNo = 0
For Each SingleVBComp In MasterVBComp
LineNo = LineNo + 1
Worksheets("fil-Macro List-3").Cells(LineNo, 1).Value = SingleVBComp.Name
Set VBCodeMod = ThisWorkbook.VBProject.VBComponents(SingleVBComp.Name).CodeModule
With VBCodeMod
StartLine = .CountOfDeclarationLines + 1
Do Until StartLine >= .CountOfLines
LineNo = LineNo + 1
Worksheets("fil-Macro List-3").Cells(LineNo, 2).Value = .ProcOfLine(StartLine, vbext_pk_Proc)
'Msg = Msg & .ProcOfLine(StartLine, vbext_pk_Proc) & Chr(13)
StartLine = StartLine + .ProcCountLines(.ProcOfLine(StartLine, vbext_pk_Proc), vbext_pk_Proc)
Loop
End With
Next
Exit Sub</pre>
This message was edited by em on 2003-01-31 23:53