how to query my web site from VBA and return a value to VBA

B

Brian Murphy

Hello All,

From VBA I would like send a value to my web site, and have it return
a value. I've learned how to use FollowHyperlink to send a value to
an ASP script, but how can the ASP script send a value back to VBA??

Thanks,

Brian
Austin, TX
 
T

Tim Williams

You can use xmlhttp to make a request to your web page:

'*********************************************************
Sub Tester()
MsgBox WebResponse("http://www.mydomain.com/myactualpage.asp?
info=blah")
End Sub

Private Function WebResponse(sURL As String) As String

Dim XmlHttpRequest As Object
Set XmlHttpRequest = CreateObject("MSXML2.XMLHTTP")
XmlHttpRequest.Open "GET", sURL, False
XmlHttpRequest.send
WebResponse = XmlHttpRequest.responseText

End Function
'***********************************************

Your ASP page just does something like:

'***************************
dim info
info = request.querystring("info")
response.write "You said '" & info & "'"
response.end
'***************************
 
B

Brian Murphy

Wow! That's almost too easy.
It's exactly what I was looking for.
Thanks bunches, Tim.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top