问题描述
我了吧code阅读器和一堆书。对于每一个的书,我想列出书名和作者在Excel US preadsheet。
I have a barcode reader and bunch of books. For each of the books, I want to list the book name and the author in an Excel spreadsheet.
我的观点是,一些VBA code连接到亚马逊网络服务将使它更容易些。
My view is that some VBA code connecting to an Amazon web service would make this easier.
我的问题是 - 没有人这样做过?你能指出我最好的例子。
My questions is - hasn't anyone done this before? Could you point me to the best example.
推荐答案
我认为这是一个容易的谷歌搜索,但结果比我预想的更加困难。
I thought it was an easy one googling, but turned out more difficult than I expected.
其实,我无法找到一个VBA ISBN基础的项目,您可以通过网络书籍的数据,所以决定做一。
In fact, I was unable to find a VBA ISBN based program to get book data from the web, so decided to do one.
下面是从 xisbn.worldcat.org 使用服务VBA宏。这里的例子。。的服务是免费的,并且不需要认证
Here is a VBA macro using the services from xisbn.worldcat.org. Examples here.. The services are free and don't need authentication.
要能够运行它,你应该检查在工具 - >引用(在VBE窗口)在Microsoft XML 6.0库。
To be able to run it you should check at Tools-> References (in the VBE window) the "Microsoft xml 6.0" library.
该宏接受从当前单元格的国际标准书号(10位),并填写以下两列,与作者和标题。您应该能够遍历一整列容易。
This macro takes the ISBN (10 digits) from the current cell and fills the following two columns with the author and title. You should be able to loop through a full column easily.
在code已经过测试(好,有点),但有没有错误检查在那里。
The code has been tested (well, a bit) but there is no error checking in there.
Sub xmlbook()
Dim xmlDoc As DOMDocument60
Dim xWords As IXMLDOMNode
Dim xType As IXMLDOMNode
Dim xword As IXMLDOMNodeList
Dim xWordChild As IXMLDOMNode
Dim oAttributes As IXMLDOMNamedNodeMap
Dim oTitle As IXMLDOMNode
Dim oAuthor As IXMLDOMNode
Set xmlDoc = New DOMDocument60
Set xWords = New DOMDocument60
xmlDoc.async = False
xmlDoc.validateOnParse = False
r = CStr(ActiveCell.Value)
xmlDoc.Load ("http://xisbn.worldcat.org/webservices/xid/isbn/" _
+ r + "?method=getMetadata&format=xml&fl=author,title")
Set xWords = xmlDoc
For Each xType In xWords.ChildNodes
Set xword = xType.ChildNodes
For Each xWordChild In xword
Set oAttributes = xWordChild.Attributes
On Error Resume Next
Set oTitle = oAttributes.getNamedItem("title")
Set oAuthor = oAttributes.getNamedItem("author")
On Error GoTo 0
Next xWordChild
Next xType
ActiveCell.Offset(0, 1).Value = oTitle.Text
ActiveCell.Offset(0, 2).Value = oAuthor.Text
End Sub
我没去,因为他们的新的直白的身份验证协议通过亚马逊...
I did not go through Amazon because of their new "straightforward" authentication protocol ...
这篇关于图书列表 - 从亚马逊获得图书详细使用Excel VBA吧code查找的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!