I am attempting to check if a PDF doc exists online using an Excel Macro, at the minute I have the following code :
Function URLExists(url As String) As Boolean
Dim Request As Object
Dim ff As Integer
Dim rc As Variant
On Error GoTo EndNow
Set Request = CreateObject("WinHttp.WinHttpRequest.5.1")
With Request
.Open "GET", url, False
.Send
rc = .StatusText
End With
Set Request = Nothing
If rc = "OK" Then URLExists = True
Exit Function
EndNow:End Function
And then in my Excel Document I'm doing :
=urlexists(http://www.whatever.bleh/thepdfname.pdf)
The URLExists code I found after some Googling, it does seem to do something but always returns False, I assume because its not specifically for checking PDFs and so not really able to do what I want. Is this possible? I've found that the HTTP HEAD method will do what I want but I don't know if I can request similar in WinHTTPRequest.