''
' For listing citations from PUBMED UIDs
'
' Jad C 2008
' this VBA script creates standard citations from pubmed UID's
'
' Use: paste a list of Pubmed UID's in a column in a worksheet, select the range and ' trigger this macro
'
' Output:
' 15778725 Spencer A Bone Marrow Transplant 2005
'
''
Option Explicit
Sub citation_maker()
'
On Error Resume Next
Dim xDoc As New MSXML2.DOMDocument
Dim xstring As String
Dim xCell As Range
Dim xtitle As String
Dim xdateY As String
Dim xdateM As String
Dim xdateD As String
Dim xissn As String
Dim xjournalName As String
Dim xjournalIssue As String
Dim xjournalVol As String
Dim xmedlinePg As String
Dim xmedlineTA As String
Dim xDiseaseState As String
Dim xAffiliation As String
Dim xAuth As String
Dim authlist As String
For Each xCell In Selection
Application.StatusBar = "getting : " + xCell.Text
xDoc.validateOnParse = False
xDoc.async = False
Dim numAuths As Integer
If xDoc.Load("http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=pubmed&id=" + xCell.Text + "&retmode=xml") Then
xdateY = xDoc.getElementsByTagName("PubDate")(0).ChildNodes(0).Text
xjournalVol = xDoc.getElementsByTagName("ISOAbbreviation")(0).ChildNodes(0).Text
xAuth = xDoc.getElementsByTagName("AuthorList")(0).ChildNodes(0).ChildNodes(0).Text + " " + xDoc.getElementsByTagName("AuthorList")(0).ChildNodes(0).ChildNodes(2).Text
Application.StatusBar = xstring
xCell.Offset(0, 5).value = xAuth + " " + Replace(xjournalVol, ".", "") + " " + xdateY
Else
xCell.Offset(0, 1).value = "NA"
Application.StatusBar = "Failed...."
End If
Next xCell
MsgBox ("done")
End Sub
Comments