Use the Web Services Toolkit

Excel doesn’t come with the Web Services Toolkit installed. In order to use web services from Visual Basic for Applications, you must first follow these steps:

  1. Find the Microsoft Office Web Services Toolkit from Microsoft by searching for “Web Services Toolkit” at www.microsoft.com/downloads.

  2. Download the Web Services Toolkit installation program (setup.exe).

  3. Run the downloaded installation program and follow the steps provided by the Setup Wizard.

  4. Start Excel and open the Visual Basic Editor.

  5. In Visual Basic, select Web References from the Tools menu. Visual Basic displays the Microsoft Office Web Services Toolkit references dialog shown in Figure 24-9.

Use the Microsoft Office Web Services Toolkit to create a web reference

Figure 24-9. Use the Microsoft Office Web Services Toolkit to create a web reference

When you create a web reference, the Web Services Toolkit automatically adds references to the Microsoft Office SOAP type library and the Microsoft XML library. Then, the toolkit generates proxy classes for the web service. To see how this works, follow these steps:

  1. From the Visual Basic Tools menu, select Web References.

  2. Select Web Service URL and type the following line in the text box below that option:

        http://api.google.com/GoogleSearch.wsdl
  3. Click Search. The Web Services Toolkit displays the web services available from Google as shown in Figure 24-10.

    Figure 24-10. Creating a reference to the Google web service

  4. Select GoogleSearchService ...

Get Programming Excel with VBA and .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.