Use VBA to call Web Service

来源:互联网 发布:js中跳出for循环 编辑:程序博客网 时间:2024/06/08 00:15

If you want to utilize web service in Excel, Word and other office tools. You have to use VBA to call web service.

Firstly, You must install the Microsoft Soap toolkit. The latest version is 3.0.

Secondly, you will add reference to you vba project. Select Tools--> Reference, select Microsoft soap type Library v3.0.

Thirdly, Edit you code to call web service.

 

Sub Button1_Click()
    
Dim str As String
    
Set Client = New SoapClient30
    Client.MSSoapInit 
"http://localhost:8866/Service.asmx?wsdl"
    
str = Client.HelloPal("Guosong")
    
MsgBox str
End Sub
原创粉丝点击