码迷,mamicode.com
首页 > 编程语言 > 详细

VBA 检查模块中是否有某个函数

时间:2015-09-06 12:43:04      阅读:198      评论:0      收藏:0      [点我收藏+]

标签:

Function FindProcedures(ByRef wb As Workbook, ByVal Proc As String) As Boolean
    On Error GoTo ExitFunction
   
    Dim VBComp
    Dim CodeMod
    Dim LineNum As Long
    Dim ProcKind
   
    For Each VBComp In wb.VBProject.VBComponents
        If VBComp.Name = "模块1" Then
       
            With VBComp.CodeModule
           
                For N = 1 To .CountOfLines
                    s = .Lines(N, 1)
                    If InStr(s, Proc) > 0 Then
                        FindProcedures = True
                        Exit Function
                    End If
                   
                Next
            End With
       
        End If
    Next
   
    Exit Function

VBA 检查模块中是否有某个函数

标签:

原文地址:http://www.cnblogs.com/lbnnbs/p/4784890.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!