We're making changes to the Community, so you may have received some notifications - thanks for your patience and welcome back. Learn more here.
Forum Discussion
Igor Kaplanov
4 years agoExplorer | Level 3
VBA Request: HTTP status code 400
I have one macro that I used to test access to https://www.dropbox.com/ and it worked for three years. But, about December 15-16, it stopped: it always gives out a HTTP status code = 400!
It reacts normally to a dozen other services. I've been fighting for 5 days, friends helped, but... Can you share your ideas?
Here is the function ('the function checks for access to the URL $ resource (file or directory) 'returns the server response code (number), or 0 if the link is invalid '(200 - resource available, 404 - not found, 403 - no access, etc.):
Public Function GetURLstatus(ByVal URL$) As Long
On Error Resume Next: URL$ = Replace(URL$, "\", "/")
Set xmlhttp = CreateObject("Microsoft.XMLHTTP")
xmlhttp.Open "GET", URL, "False"
xmlhttp.setRequestHeader "If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT"
xmlhttp.send
GetURLstatus = Val(xmlhttp.Status)
Set xmlhttp = Nothing
End Function
a fragment of a macro where this function is used:
URL$ = "https://dropbox.com/" 'directory link
If GetURLstatus(URL$) = 200 Then........
or:
MsgBox GetURLstatus(URL$), vbInformation, URL$
- ЗдравкоLegendary | Level 20
Hi Igor Kaplanov,
Are you sure for the validity of link(s) in use? 🧐 What's going on when you try the same link(s) in a browser' incognito window? 🤔
Hope this gives some direction.
- Igor KaplanovExplorer | Level 3
Yes I am sure. The link works. https://www.dropbox.com/ loads the dropbox page in any mode.
- Greg-DBDropbox Staff
I recommend checking the body of the error response. It may contain a more useful error message or error page.
For instance, the Dropbox web site recently dropped support for Internet Explorer 11, so if your HTTP client is setting a User-Agent that appears to be Internet Explorer 11, the Dropbox web site will now return an error page indicating that it is no longer supported.
In that case, you could fix this by updating your code to not set a User-Agent string that appears to be Internet Explorer. (I can't provide support for VBA or Microsoft.XMLHTTP, but you might be able to set the "User-Agent" header via the "xmlhttp.setRequestHeader" method, like you're using to set your "If-Modified-Since" header.)
About Discuss Dropbox Developer & API
795 PostsLatest Activity: 3 days ago
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!