Hallo Zusammen,
ich hab eine rießen Anzahl (>1000) von Links in einer Tabelle, die auf Funktionalität überprüft werden müssen. Noch dazu gibt es manche Links die auf einen internen Server verweißen. Bin komplett neu in VBA, und hab mir aus Recherchen bissl was zusammen gebastelt:
Option Explicit
Function urlExists(url As String)
Dim obj As Object
Set obj = CreateObject("MSXML2.XMLHTTP")
On Error Resume Next
obj.Open "GET", url, False
obj.send
If obj.Status = 200 Then urlExists = True
On Error GoTo 0
End Function ' urlExists
Weiter gehts dann damit, dass ich die verschiedenen Fälle abfangen will, nämlich Link im internet, Link auf interenen Server, Link im intranet:
Sub urlCheck()
Dim link As String
Dim link0 As String
Dim link1 As String
Dim link2 As String
Dim link3 As String
'URL that does not exists
link0 = "http://15154852.de/"
'Object that exists, but has no content
link1 = "file://de012345/Database/working/test."
' file that exists
link2 = "file://de012345/Database/working/test.pdf"
"
' URL which exists, but has no content
link3 = "https://intra.com/people/tititi"
''''' HERE YOU CAN TRY
'' Just change the number in linkXXXXXX
link = link0
If urlExists(link) Then
MsgBox "OK"
Else
MsgBox "The following link does not exists: " & link
End If
End Sub ' urlCheck
Aber irgendwie ist das noch nicht der richtige Ansatz. Danke für eure Hilfe.
|