Word 2007: Accessing the date regarding sources...

WaxonWaxov

Board Regular
Joined
Apr 9, 2009
Messages
141
Hi!

OK, Word 2007, references tab... manage sources.

This is a great tool for managing the sources you use when writing research papers to automatically create a bibliography.

Is there a way, in VBA code, to access this data? It's obviously being stored in a file somewhere as Word remembers all your sources from one document to the next.

What I am doing: I love to write for Wikipedia. Beating the Wiki-nazis at their own game has become sport for me. Taking a fairly obscure historical figure and researching and writing an article = big fun as far as I am concerned. (I know I'm a nerd)

Anyhow, it's difficult to write in wikicode in Word as word freaks-out calling all the clode incorrectly spelled, plus reading the text is difficult with all that code mixed-in.

So what I am doing is writing a proceedure that will automatically convert a research paper written in Word to wikicode. Sor far everything works beautifully. Automatic conversion of bold, italic, links to other wiki articles (very important), links to other sites, section headings, and I've even got endnote (footnotes) to convert to wikicode perfectly. If it sounds like I'm proud of myself I am.

Any help on accessing the date stored within Word's source library will be much appreciated.
 
Last edited:

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
OK, with the help of this site: http://www.uwec.edu/help/Word07/bib-srcfile.htm

I was able to find the xml file:
C:\Documents and Settings\your_username\Application Data\Microsoft\Bibliography\Sources.xml

Then I got some sample code from this site: http://msdn.microsoft.com/en-us/library/bb258052(v=office.12).aspx

Here is what I have right now....
Code:
Sub showFieldValue()
    Dim objSource As Source
    Dim strXml As String
 
    On Error Resume Next
 
    For Each objSource In ActiveDocument.Bibliography.Sources
 
        Debug.Print objSource.Field("b:Author")
    Next
End Sub

Which results in the authors lastname and first name strung together.

The fields Last and First (names) are nested within other fields in the xml data as such:

Code:
<b:Author>
<b:Author>
<b:NameList>
<b:Person>
<b:Last>Waxov</b:Last>
<b:First>Waxon</b:First>
</b:Person>
</b:NameList>
</b:Author>
</b:Author>

So my above code results in WaxovWaxon

When I enter just b:Last or b:First in the field argument above, I get a blank result.

How do I get the code to look at those nested fields?

Once I get this, I think I'm home free.
 
Upvote 0

Forum statistics

Threads
1,224,582
Messages
6,179,670
Members
452,936
Latest member
anamikabhargaw

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top