excel 超链接 批量校验是否可用

// 校验超链接对应文件地址 是否存在
Public Function FileFolderExists(strFullPath As String) As Boolean

    On Error GoTo EarlyExit

    If Not Dir(strFullPath, vbDirectory) = vbNullString Then FileFolderExists = True

EarlyExit:

    On Error GoTo 0

End Function


Sub check()

Dim url1 As String, chk As Boolean

For i = 6 To 158

    If Cells(i, "e").Value <> "" Then

    url1 = "Z:\CMMI修改后\" & Cells(i, "e").Value

    chk = FileFolderExists(url1)

    Cells(i, "q").Value = IIf(chk, "有效", "无效")

    End If

Next

End Sub

你可能感兴趣的:(excel 超链接 批量校验是否可用)