Hello,
I have a function to validate URLs. It return as result "200" if the URL is valid and "404" if the URL is invalid. It works fine with simple URLs like: http://www.mywebsite.com/products/dresses/blue-dress
But it not work properly with URLs which contain anchors (#). For this kind of URLs the function returns also "404" as result although the URLs are working/good URLs. An example of this kind of URL: http://mywebsite.com/en/women/dresses/59983-lovydress_1#/237-color-maroon/117-size-40 This is a prestashop URL which contain color and size variation.
I use Excel 2003 and unfortunately I can't upgrade Excel because I work not on my PC and I have no permision for upgrade.
I send bellow my function, have somebody a solution ?
I have a function to validate URLs. It return as result "200" if the URL is valid and "404" if the URL is invalid. It works fine with simple URLs like: http://www.mywebsite.com/products/dresses/blue-dress
But it not work properly with URLs which contain anchors (#). For this kind of URLs the function returns also "404" as result although the URLs are working/good URLs. An example of this kind of URL: http://mywebsite.com/en/women/dresses/59983-lovydress_1#/237-color-maroon/117-size-40 This is a prestashop URL which contain color and size variation.
I use Excel 2003 and unfortunately I can't upgrade Excel because I work not on my PC and I have no permision for upgrade.
I send bellow my function, have somebody a solution ?
Code:
Public Function CheckURL(url As String) Dim request As Object
Set request = CreateObject("WinHttp.WinHttpRequest.5.1")
On Error GoTo haveError
With request
.Open "HEAD", url
.Send
CheckURL = .Status
End With
Exit Function
haveError:
CheckURL = Err.Description
End Function