Visio Discussions > ShapeSheet & Smart Shapes
Checking if cell exists
wapperdude:
I did a little bit of searching, found David Parker's work on Icon Sets. Did not investigate in detail, but this article seems like a gateway for his efforts related to the topic. That is, at the bottom is a list of related links. Hope this helps...https://bvisual.net/2015/03/18/a-table-of-visio-data-graphic-icon-sets/
Yacine:
Hi,
Your formulation is confusing, sorry.
I understand, that you don't only want an icon, but also the value as text in the smartgraphic.
Why don't you build the set accordingly. E.g.: an icon set PLUS a text display? That's out of the box, no tweaking.
ITWorkingSolutions:
--- Quote from: Yacine on September 23, 2022, 10:51:20 AM ---Hi,
Your formulation is confusing, sorry.
I understand, that you don't only want an icon, but also the value as text in the smartgraphic.
Why don't you build the set accordingly. E.g.: an icon set PLUS a text display? That's out of the box, no tweaking.
--- End quote ---
Hi Yacine, sorry I probably could have explained better. The text is dynamic depending on what the user selects as the value when the use the Icon Set. The issue is visio doesn't populate prop.msvCalloutField for an Icon Set. It does for the other types i.e. Text or Data Bar. What MS does set is User.visDGField[sequential count]. So I'm trying to find a smart way of finding what the user-defined name is when I don't know the [sequential count] value. The one method is using the testing method, but I don't know how high [sequential Count] might go.
Another method might be to scan the formula in user.msvCalloutIconNumber and get the name, but I don't know how to get the formula in shapesheet. Below is an example of user.msvCalloutIconNumber where the User.visDGField10 name is in. But I can't see a method to get the formula rather than the value to use a combination of find and other methods to get the name from. I may be asking the impossible.
=IF(STRSAME(User.visDGField10,"Level 1",TRUE),0,IF(STRSAME(User.visDGField10,"Level 2",TRUE),1,IF(STRSAME(User.visDGField10,"Level 3",TRUE),2,IF(STRSAME(User.visDGField10,"Level 4",TRUE),3,IF(STRSAME(User.visDGField10,"Level 5",TRUE),4,-1)))))
Hope this explains a bit better.
ITWorkingSolutions:
--- Quote from: wapperdude on September 23, 2022, 09:48:50 AM ---I did a little bit of searching, found David Parker's work on Icon Sets. Did not investigate in detail, but this article seems like a gateway for his efforts related to the topic. That is, at the bottom is a list of related links. Hope this helps...https://bvisual.net/2015/03/18/a-table-of-visio-data-graphic-icon-sets/
--- End quote ---
Hey thanks wapperdude, David Parker is legend but hasn't solved this one that I can see. I have a real cludge in testing none to 50 sequential numbers, but I have no idea if the number could go to 100, 200, or even higher. Hence need a better way of getting name... if one exists.
Thanks...
wapperdude:
The attached file has a shape with 5 rows in the User section. There is also the VBA code shown below. Thjis code loops thru the User section and checks to see which rows, if any, have row name that contains "From" as the root. Both the name and entry value arre debug printed.
--- Code ---
Sub findRow()
Dim vsoShp As Visio.Shape
Dim RowCnt As Integer
Dim CellVal As String
Set vsoShp = ActiveWindow.Selection(1) 'Select shape to examine
RowCnt = vsoShp.RowCount(Visio.visSectionUser) 'Determine how many rows in the User section
sect = Visio.VisSectionIndices.visSectionUser 'Deterine the ID of the User section. Optioonal. Less typing.
For i = 0 To RowCnt - 1 'Row index starts with zero, not 1
Rname = "User." & vsoShp.CellsSRC(sect, i, 1).RowName 'This is the full row name
CellVal = vsoShp.CellsSRC(sect, i, 0).ResultStr(Visio.visNone) 'This is the value stored
If Rname Like "User.From*" Then 'This does string comparison allowing for wildcard variants; successful compare prints out name and value
Debug.Print Rname
Debug.Print CellVal
End If
Next
End Sub
--- End code ---
Modify the code to meet your search needs. Since the comparison test is desired string variant, versus actual row names, there is no error for non-existinting row.
HTH
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version