EXCEL VBA判断是否有重名的工作表

发布时间:2024年01月23日

EXCEL VBA判断是否有重名的工作表

Function blnWBExist(ByVal strWbName As String) As Boolean
    Dim wkbName As Workbook
    For Each wkbName In Workbooks
        If wkbName.Name = strWbName Then
            blnWBExist = True
            Exit For
        End If
    Next wkbName
    Set wkbName = Nothing
End Function

Function blnExistWB(ByVal strWbName As String) As Boolean
    Dim wkbName As Workbook
    On Error Resume Next
    Set wkbName = Workbooks(strWbName)
    If Err.Number = 0 Then blnExistWB = True
    Set wkbName = Nothing
End Function

文章来源:https://blog.csdn.net/weixin_43050480/article/details/135792715
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。