Hello All,
I have several different ways I may use this, so is there a sort of template or a general method that can be used to extract objects/text from Visio based on the color properties of the object. I am certainly willing to write it myself, but would appreciate any direction to get started. NOTE: This is a very very large Visio....
Please provide an example drawing that describes exactly what you want to do. Then we can give you a starting point to implement this feature.
...adding to what Thomas indicates...
The basic process is to loop thru each page in the Visio file, and to loop thru each shape on the page. For each shape you test that shape for whatever you're interested in, e.g., fill color, text color. If the test succeeds, then you have the shape you want. You can then either do editing before moving on to next shape, or you can store it in an array, or whatever.
For example, to look at fillcolor, you can use the CellsSRC or Cells methods. To get the results (contents/values) there's the .results or resultsStr methods. Seems complicated, but it's not once you get into it.
Well, there are some complications with regards to colors. Color entries have a variety of formats, and that creates some additional work.
So, having more details will be most helpful. Here's a really simple code that checks the fill color cell for yellow as defined by RGB(255,255,0) format.
Sub selbyfillcolor()
Dim vsoPage As Visio.Page, vsoShape As Visio.Shape
For Each vsoPage In ThisDocument.Pages
For Each vsoShape In vsoPage.Shapes
If vsoShape.Cells("FillForegnd").ResultStr(visNone) = "RGB(255, 255, 0)" Then
' Your code goes here, for example:
Debug.Print vsoPage.Name & " " & vsoShape.Name & " " & vsoShape.Cells("FillForegnd").ResultStr(visNone)
End If
Next
Next
End Sub