cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Discuss Dropbox Developer & API

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

VBA Request: HTTP status code 400

VBA Request: HTTP status code 400

Igor Kaplanov
Explorer | Level 3

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$

 

3 Replies 3

Здравко
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 Kaplanov
Explorer | Level 3
 

 Yes I am sure. The link works. https://www.dropbox.com/ loads the dropbox page in any mode.

Greg-DB
Dropbox 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.)

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    Igor Kaplanov Explorer | Level 3
  • User avatar
    Здравко Legendary | Level 20
What do Dropbox user levels mean?