Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Variable Interface 

Represents a variable stored as part of a document. Document variables are used to preserve macro settings in between macro sessions.

Namespace: Microsoft.Office.Interop.Word
Assembly: Microsoft.Office.Interop.Word (in microsoft.office.interop.word.dll)

'Usage
Public Class ariableImplementation
	Implements Variable
End Class
Dim ariableImplementation1 As New ariableImplementation()

public interface Variable
public interface Variable
public interface Variable

The Variable object is a member of the Variables collection. The Variables collection includes all the document variables in a document or template.

Use Variables(index), where index is the document variable name or the index number, to return a single Variable object.

The index number represents the position of the document variable in the Variables collection. The last variable added to the Variables collection is index number 1; the second-to-last variable added to the collection is index number 2, and so on.

Use the Add of the Variables collection method to add a variable to a document.

If you try to add a document variable with a name that already exists in the Variables collection, an error occurs. To avoid this error, you can enumerate the collection before adding any new variables.

Document variables are invisible to the user unless a DOCVARIABLE field is inserted with the appropriate variable name.

To add a document variable to a template, open the template as a document by using the OpenAsDocument method.


Development Platforms

Windows XP Home Edition, Windows XP Professional, Windows Server 2003, and Windows 2000

Target Platforms

Community Additions

Show:
© 2014 Microsoft