Document.GetThemeNames method (Visio)

Returns a locale-specific array of names of themes contained in the document.

Syntax

expression.GetThemeNames (eType, NameArray())

expression An expression that returns a Document object.

Parameters

Name Required/Optional Data type Description
eType Required VisThemeTypes The type of the theme, an enumerated value from the VisThemeTypes enumeration. See Remarks for possible values.
NameArray() Required String Out parameter. An array of locale-specific theme names returned by the method.

Return value

Nothing

Remarks

For the eType parameter, pass a value from the VisThemeTypes enumeration, which is declared in the Visio type library.

Constant Value Description
visThemeTypeColor 1 Color themes.
visThemeTypeEffect 2 Effect themes.

For the NameArray() out parameter, pass an empty, dimensionless array of type String. Visio returns the array filled with locale-specific names of themes contained in the document.

To get locale-independent themes in the document, use the Document.GetThemeNamesU method.

Note

Beginning with Microsoft Visio 2000, you can use both local and universal names to refer to Visio shapes, masters, documents, pages, rows, add-ons, cells, hyperlinks, styles, fonts, master shortcuts, UI objects, themes, and layers. When a user names a shape, for example, the user is specifying a local name.Beginning with Microsoft Office Visio 2003, the ShapeSheet spreadsheet displays only universal names in cell formulas and values. (In prior versions of Visio, universal names were not visible in the user interface.) As a developer, you can use universal names in a program when you don't want to change a name each time a solution is localized.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the GetThemeNames method to get the list of locale-specific theme color and theme effect names in the active document. It prints the list in the Immediate window.

Public Sub GetThemeNames_Example() 
 
    Dim astrNames() As String 
    Dim strThemeName As String 
    Dim intArrayCounter As Integer 
     
    ActiveDocument.GetThemeNames visThemeTypeColor, astrNames 
     
    For intArrayCounter = LBound(astrNames) To UBound(astrNames) 
        strThemeName = astrNames(intArrayCounter) 
        Debug.Print strThemeName 
    Next 
     
    Debug.Print "-------------------------------------------" 
     
    ActiveDocument.GetThemeNames visThemeTypeEffect, astrNames 
     
    For intArrayCounter = LBound(astrNames) To UBound(astrNames) 
        strThemeName = astrNames(intArrayCounter) 
        Debug.Print strThemeName 
    Next 
     
End Sub

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.