Class Source (Word VBA)

The class Source represents an individual source, such as a book, journal article, or interview.

Set

To use a Source class variable it first needs to be instantiated, for example

Dim src as Source
Set src = Application.Bibliography.Sources(Index:=1)

The following procedures can be used to set variables of type Source: Sources.Item and Bibliography.Sources

For Each

Here is an example of processing the Source items in a collection.

Dim src As Source
For Each src In Application.Bibliography.Sources
	
Next src

Cited

Returns a Boolean that represents whether a source has been cited in a document.

Dim booCited As Boolean
booCited = Application.Bibliography.Sources(1).Cited

Delete

Deletes the specified source.

Application.Bibliography.Sources(1).Delete

Field

Returns a String that represents the value of a field in a bibliography source.

The name of the field corresponds to the name of the corresponding XML element in the resulting XML for a bibliography source. You can use the XML property to return the XML for a bibliography source. For more information, see Working with Bibliographies.

Syntax : expression.Field (Name)

Name: Specifies the name of the field for which to retrieve the value.

Dim strName As String: strName =  
Application.Bibliography.Sources(1).Field(Name:=strName) =

Parent

Returns an object that represents the parent object of the specified Source object.

Dim objParent As Object
Set objParent = Application.Bibliography.Sources(1).Parent

Tag

Returns a String that represents an internal identifying label for a source.

Dim strTag As String
strTag = Application.Bibliography.Sources(1).Tag

XML

Returns a String that represents the XML markup for a Source object.

The Data parameter of the Add method for the Sources object requires a valid XML string that contains data for the necessary elements. Depending on the type of source that you add, the XML may change. To determine what the correct XML needs to be for a specific type of source, create a source through the Create Source dialog box, and then use the XML property to return the correct XML syntax.

Dim strXML As String
strXML = Application.Bibliography.Sources(1).XML

Sources.Add

Add a new source to the sources listed in the Source Manager dialog box.

Syntax : expression.Add (Data)

Data: An XML string that represents the field values for the new source.

Dim strData As String: strData =  
Application.Bibliography.Sources.Add Data:=strData

Sources.Count

Returns the number of items in the Sources collection.

Dim lngCount As Long
lngCount = Application.Bibliography.Sources.Count

Sources.Item

Returns a Source object that represents the specified item in the collection.

Syntax : expression.Item (Index)

Index: Specifies the ordinal position of the object within the collection.

Dim src As Source
Set src = Application.Bibliography.Sources(Index:=1)

Sources.Parent

Returns an object that represents the parent object of the specified Sources object.

Dim objParent As Object
Set objParent = Application.Bibliography.Sources.Parent