写了一个插件 vba vb6
把每一个 函数或过程 都 添加输出函数名到立即窗口的代码. 可以看到 函数调用的过程.
Dim i As Long: Dim j As Long: Dim k As Long Dim VBCs As VBComponents Dim cm As CodeModule Dim ProcName As String Dim ProcKind As VBIDE.vbext_ProcKind Dim pbl As Long: Dim tempStr As String: Dim pbl1 As Long 'pbl1 函数身体+1行 txtText1.Text = "" Set VBCs = VBInstance.ActiveVBProject.VBComponents For i = 1 To VBCs.Count Set cm = VBCs(i).CodeModule txtText1.Text = txtText1.Text & VBCs(i).Type & ":" & VBCs(i).Name & "--------" & vbCrLf j = 0 With cm j = .CountOfDeclarationLines + 1 Do Until j >= .CountOfLines ProcName = .ProcOfLine(j, ProcKind) pbl = .ProcBodyLine(ProcName, ProcKind) txtText1 = txtText1 & ProcName & " | " & ProcKindString(ProcKind) & " | " _ & pbl & vbCrLf j = .ProcStartLine(ProcName, ProcKind) + .ProcCountLines(ProcName, ProcKind) For k = pbl To j tempStr = .Lines(k, 1) If Right(tempStr, 1) <> "_" Then pbl1 = k + 1 Exit For End If Next For k = pbl1 To j tempStr = Trim(.Lines(k, 1)) If Len(tempStr) > 0 Then If (Left(tempStr, 11) = "Debug.Print") And (Right(tempStr, 8) = "'统一输出函数名") Then Call cm.DeleteLines(k, 1) k = k - 1 j = j - 1 End If End If Next Call cm.InsertLines(pbl1, " " & "Debug.Print """ & "--> " & ProcName & """ '统一输出函数名") j = .ProcStartLine(ProcName, ProcKind) + .ProcCountLines(ProcName, ProcKind) + 1 Loop End With txtText1.Text = txtText1.Text & vbCrLf Next