Microsoft XML Core Services (MSXML) 5.0 for Microsoft Office - DOM Developer's Guide

Class Module: myHttpRequestHandlers

To enable asynchronous requests, we add a class module as an event handler for the onreadystatechange events of an IXMLHTTPRequest object.

To add the class module

  1. Select Add Class Module from the Project menu in the Visual Basic editor, and click Open to open a new class module.
  2. Change the name of the new class module from "Class1" to "myHttpRequestHandlers".
  3. Paste the following code into the class module:
    Option Explicit
    Sub OnReadyStateChange()
        If form1.oHttpReq.readyState = 4 Then
            form1.ProcessResponse
        End If
    End Sub

There are other ways to set up the event handler. For more information, see Use the OnReadyStateChange Property in Visual Basic.

Next, we'll set up a virtual directory. You must complete this step before you build and run the application.