Info

Now that the workbook is set up,you can switch to VBA to enter the code needed to retrieve data from Amazon.com.

The first step is to go to Tools, References and add a reference to Microsoft WinHTTP Services.

The Amazon Development Kit provides many sample URL strings to return various searches by author, publisher, ISBN, and so on.

After defining the proper URL string, the string is sent as a WinHttpRequest.The results are then mapped to the worksheet through the use of the .ImportXML method.

This sample code queries Amazon for all books written by Bill Jelen and published in 2002:

Sub QuerybyAuthor()

' Query all Bill Jelen books published in 2002

Dim ws As Worksheet

Dim whr As New WinHttpRequest

Dim lobj As ListObject

Dim nCount As Integer

Dim objSelected As Object

Dim sURI As String

0 0

Post a comment