Getting “method not valid without suitable object” error when trying to make a HTTP request in VBA?

前端 未结 4 1349
眼角桃花
眼角桃花 2020-12-05 03:29

I tried to follow this example: http://libkod.info/officexml-CHP-9-SECT-5.shtml - Archive.org - Donate

but it gave this error

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-05 03:42

    You probably haven't added a reference to Microsoft XML (any version) for Dim objHTTP As New MSXML2.XMLHTTP in the VBA window's Tools/References... dialog.

    Also, it's a good idea to avoid using late binding (CreateObject...); better to use early binding (Dim objHTTP As New MSXML2.XMLHTTP), as early binding allows you to use Intellisense to list the members and do all sorts of design-time validation.

提交回复
热议问题