• vb6 Vba 插件 添加输出函数名到立即窗口 Addin


    写了一个插件 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
  • 相关阅读:
    php字符串相加
    elementUI的input输入一个字符就失去焦点问题
    js鸡尾酒排序算法
    js快速排序算法
    js冒泡排序算法改进
    js实现队列
    EXIF.js 读取图片的方向
    new Image().src资源重复请求问题
    canvas绘制圆图输出图片格式
    去掉"You are running Vue in development mode"提示
  • 原文地址:https://www.cnblogs.com/MadeInChinese/p/15557118.html
Copyright © 2020-2023  润新知