Setting callback for COM Object (XMLHTTP)

S

sl1210MKII

Hi,

currently I'm using Office 2002 for consuming an XMLHTTP Request.
Basiclly everything works fine but I need an asynchronous request.
Therefore I would like to set a callback to one of myfunctions. My code
looks Something like this:

Private Function loadFromUrl(URL As String)
Dim http As Object

Set http = CreateObject("MSXML2.XMLHTTP")
http.Open "GET", URL, False
http.send
End Function

This works fine. Now I try to make it asynchron, so I add a function

Function statechange()
' .....
End Function

And add an line
http.OnReadyStateChange = statechange
to my LoadFromURL function. During Execution I get an runtime error 13:
"Type mismatch" on that line. I tryed multiple alternatives to defien
that Callback but none worked.

Thanks for help,
johannes
 
S

sl1210MKII

Hi Tushar,

thanks for the link but it didn't helpl me. It looks similar to what I
tryed but I guess my problem is related to the fact that I'm using VBA
not VB and I don't know enough about it the see what I would need to
change... My code is below.

Thnaks for help!
johannes
 
S

sl1210MKII

Nobody has an idea?

Hi Tushar,

thanks for the link but it didn't helpl me. It looks similar to what I
tryed but I guess my problem is related to the fact that I'm using VBA
not VB and I don't know enough about it the see what I would need to
change... My code is below.

Thnaks for help!
johannes
 

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