Sending HTTP requests with VBA from Word

A potential alternative to avoid having to select the library is to use an object i.e.

Sub http()
Dim MyRequest As Object

    Set MyRequest = CreateObject("WinHttp.WinHttpRequest.5.1")
    MyRequest.Open "GET", _
    "http://www.google.com"

    ' Send Request.
    MyRequest.Send

    'And we get this response
    MsgBox MyRequest.ResponseText

End Sub

Leave a Comment