linking VISIO external data to shapes

L

LeeAnn

I continue to have problems linking shapes to external data:

I have customized a VISIO 2007 professional session so that the shape data
holds only one attribute "unique id". This attribute is used to link a Shape
to external data (Excel 2003 spreadsheet) that has 30 data elements
(columns). When I add a row or change row values in the Excel 2003
spreadsheet and then refresh the external data, the VISIO shape data changes
from only one
attribute to 31 attributes. I would like the shape data to remain as only
one attribute ("unique id").

It was suggested that when I create the original link, I can Select Columns
from the Data Selector, to limit the shape data created. I tried this. Only
the one column shows in the shape data....but... that is also what shows in
the external data window of VISIO. I would like the 1 attribute to show in
the shape data and all 31 to show in the external data window.

Any suggestions on how to change this behavior.

Thanks for the help
-Lee Ann
 
D

David Parker

What you are trying to do is not normal functionality - Link Data to Shapes
is supposed to cache the properties in the shapes.
Therefore, you will need to do some customisation, which could be one of the
following:
1. Hide the extra Shape Data rows in the shapes (using the
2. Write a custom Link Data to Shapes that only copies the UniqueID field
3. Only link the one column from the spreadsheet, but write you own data
window for the complete set of columns

1 is the least complicated because you could do the following in VBA (I have
used "Network Name" as the column label so that you can test with the Visio
sample "It Asset Management"):

Public Sub HideExtraData()
ChangeDataHidden "Network Name", True
End Sub

Public Sub ShowExtraData()
ChangeDataHidden "Network Name", False
End Sub

Public Sub ChangeDataHidden(ByVal label As String, ByVal hide As Boolean)
Dim shp As Visio.Shape
Dim pag As Visio.Page
Dim iRow As Integer
Dim hiddenFormula As String
If hide = True Then
hiddenFormula = "=1"
Else
hiddenFormula = "="
End If

For Each pag In Visio.ActiveDocument.Pages
For Each shp In pag.Shapes
For iRow = 0 To shp.RowCount(Visio.visSectionProp) - 1
If shp.CellsSRC(Visio.visSectionProp, iRow,
Visio.visCustPropsLabel).ResultStr("") <> label Then
shp.CellsSRC(Visio.visSectionProp, iRow,
Visio.visCustPropsInvis).Formula = hiddenFormula
End If
Next iRow
Next shp
Next pag
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top