I'm trying to capture data from a web form to an Excel spreadsheet. An Excel web query didn't work so, following a suggestion, I am now trying to do it using VBA and XMLHTTP. Never used XMLHTTP before and I'm not even sure whether this is the right forum for this question...
This is the url to the form itself:
http://www.bmreports.com/servlet/com....bwp_PanBmData
This is an example url including form inputs, that works if I submit it manually:
http://www.bmreports.com/servlet/com...1=i_isg-spow1& param5=2003-06-14& param6=
(Sorry, long url - you might have to copy-paste)
This is my first attempt at VBA code:
------------------------------------------------
Sub XMLTest()
Dim XMLhttp: Set XMLhttp = CreateObject("msxml.xmlhttp")
Dim Result
Dim ReqString: ReqString = "?param1=i_isg-spow1¶m5=2003-06-14¶m6=*"
XMLhttp.Open "POST", "http://www.bmreports.com/servlet/com.logica.neta.bwp_PanBmData", False
XMLhttp.setrequestheader "Content-Type", "application/x-www-form-urlencoded"
XMLhttp.send ReqString
Result = XMLhttp.responsetext
MsgBox Result
End Sub
------------------------------------------------
The result I get back is a "400 Bad Request" error - "Your browser sent a request that this server could not understand".
I tried removing the leading question mark from the ReqString - doesn't make any difference.
Any ideas?