Table of contents
Collapse the table of content
Expand the table of content

DataColumn.SetProperty Method (Visio)

office 365 dev account|Last Updated: 6/12/2017
1 Contributor

Sets the value of the specified data-column property.

Note This Visio object or member is available only to licensed users of Visio Professional 2013.


expression . SetProperty( Property , Value )

expression An expression that returns a DataColumn object.


NameRequired/OptionalData TypeDescription
PropertyRequiredVisDataColumnPropertiesThe data-column property whose value you want set. See Remarks for possible values.
ValueRequiredVariantThe value to assign the data-column property. See Remarks for possible values.

Return Value



When you link shapes in a Microsoft Visio drawing to data in a data recordset, Visio maps columns in the data recordset to rows in the Shape Data section of the ShapeSheet spreadsheet, each of which corresponds to a shape-data item.

Note In some previous versions of Visio, shape data were called custom properties.

Data-column properties map data columns to certain cells in the Shape Data section of the ShapeSheet. For example, by passing the SetProperty method a new value for the DisplayName property, which is represented by the enumerated value visDataColumnPropertyDisplayName , you set the value of the Label cell in the Shape Data section of the ShapeSheet for a particular shape data item. In addition, setting that property sets the label of the shape data item in the Shape Data dialog box, as well as the name of the data column that is displayed in the External Data window in the Visio user interface. These settings correspond to those that you can set in the Column Settings dialog box in the Visio user interface (right-click in the External Data window and then click Column Settings), as well as those that you can make in the Types and Units dialog box for each column (click Data Types in the Column Settings dialog box.)

Possible values for the Property parameter are declared in VisDataColumnProperties , and are shown in the following table.

** visDataColumnPropertyCalendar**3Calendar of the data-column property.
visDataColumnPropertyCurrency5Currency of the data-column property.
visDataColumnPropertyDisplayName6Display name of the data-column property in the UI.
visDataColumnPropertyHyperlink8Whether the data-column value becomes a hyperlink in the Visio UI when it is linked to a shape.
visDataColumnPropertyLangID2Language ID of the data-column property.
visDataColumnPropertyType1Data type of the data-column property.
visDataColumnPropertyUnits4Units of the data-column property.
visDataColumnPropertyVisible7Whether the data-column property is visible in the UI.

Possible values for the Value parameter depend on the Property parameter value. The following table shows valid data-column property values for each data-column property, depending on the data-column data type.

********Data Column Data Type********************
Number (VisCellVals.visPropTypeNumber)Date (VisCellVals.visPropTypeDate)Currency (VisCellVals.visPropTypeCurrency)Duration (VisCellVals.visPropTypeDuration)String (VisCellVals.visPropTypeString)Boolean (VisCellVals.visPropTypeBoolean)
Data Column PropertyTypevisPropTypeNumbervisPropTypeDatevisPropTypeCurrencyvisPropTypeDurationvisPropTypeStringvisPropTypeBoolean
LangIDValid LCID number
CurrencyValid 3-letter currency-constant string as used in the CY function in the Visio ShapeSheet spreadsheet.
CalendarOne of the members of VisCellVals , depending on the LangID value. (See table below.)
UnitsOne of the following members of VisUnitsCodes :

  • visAcre

  • visAngleUnits

  • visCentimeters

  • visCiceros

  • visCicerosAndDidots

  • visDegreeMinSec

  • visDegrees

  • visDrawingUnits

  • visFeet

  • visFeetAndInches

  • visHectare

  • visDidots

  • visInches

  • visInchFrac

  • visKilometers

  • visMeters

  • visMileFrac

  • visMiles

  • visMillimeters

  • visMin

  • visNautMiles

  • visPageUnits

  • visPicas

  • visPicasAndPoints

  • visPoints

  • visRadians

  • visSec

  • visYards

  • visNumber (special behavior ? this constant makes the value unitless)

OR Descriptive string?a string used for units, such as cm or sq cm . This string will be validated so that it is one of the supported Visio units. Passing invalid strings causes the method to fail.|||One of the following members of VisUnitsCodes :
  • visDurationUnits

  • visElapsedDay

  • visElapsedHour

  • visElapsedMin

  • visElapsedSec

  • visElapsedWeek

OR Descriptive string?a string used for units such as ew . This string will be validated so that it is one of the supported Visio units. Passing an invalid string will cause this method to fail.||| ||HyperLink||||| Boolean|| The LangID and Calendar properties are bound by the validation rules shown in the following table. Languages not shown use the Western calendar only.

CalendarHirjiWesternFrench TransliteratedEnglish TransliteratedHebrew LunarSaka EraJapanese Emperor EraKorean DankiThai Buddhist
All Arabicxxxx
All Englishxxxx
Kashmiri (Arabic)xx
Punjabi (Pakistan)xx


The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the GetProperty method to get the value of the Label cell in the Shape Data section for the first column in the data recordset passed to the method and display it in the Immediate window. Then it uses the SetProperty method to set the value and displays the new value. Changing this value changes the label of the shape data item in the Shape Data dialog box for all shapes linked to rows in the data recordset.

To get and set the Label cell value, the macro passes the visDataColumnPropertyDisplayName value from the VisDataColumnProperties enumeration to the DataColumn.GetProperty and DataColumn.SetProperty methods.

Before running this macro, create at least one data recordset in your VBA project to pass to the macro.

Public Sub SetProperty_Example(vsoDataRecordset As Visio.DataRecordset) 
    Dim strPropertyName As String 
    Dim strNewName As String 
    Dim vsoDataColumn As Visio.DataColumn 

    strNewName = "New Property Name" 
    Set vsoDataColumn = vsoDataRecordset.DataColumns(1) 

    strPropertyName = vsoDataColumn.GetProperty(visDataColumnPropertyDisplayName) 
    Debug.Print strPropertyName 

    vsoDataColumn.SetProperty visDataColumnPropertyDisplayName, strNewName 
    strPropertyName = vsoDataColumn.GetProperty(visDataColumnPropertyDisplayName) 
    Debug.Print strPropertyName 
End Sub
© 2018 Microsoft