|
-
Oct 28th, 2008, 03:52 PM
#1
Thread Starter
New Member
Saving Visio Shape Selections Using VBA
Hello,
I am creating a routing diagram in Visio with VBA capabilities.
I would like to have the user define the critical path of the system by selecting the appropriate connectors/shapes and then run a macro which would save the selection to a specific name (ie. CPgroup) that could be used outside of the selection Sub. Then another macro would toggle the highlighting (toggle lineweights/colors) of the "CPgroup" so that the user could easily view the critical path at any given time.
I am trying to make this very user friendly for people who don't understand VBA which is the reason why I am splitting this into two macros. I currently have a macro that toggles the highlighting, but in order to change the critical path, I would need to edit the code and change the ItemID numbers.
With the selection feature the user can select the current critical path by selecting the shapes and connectors, and then toggle the highlighting with another switch, so he/she would never have to edit the code itself.
Any suggestions?
Thanks!
Kyle
I would be editing properties similar to these:
Sub CP()
' Keyboard Shortcut: Ctrl+Shift+C
'
Dim UndoScopeID1 As Long
UndoScopeID1 = Application.BeginUndoScope("Line Properties")
Application.ActiveWindow.Page.shapes.ItemFromID(6).CellsSRC(visSectionObject, visRowLine, visLineWeight).FormulaU = "4.08 pt"
Application.ActiveWindow.Page.shapes.ItemFromID(9).CellsSRC(visSectionObject, visRowLine, visLineWeight).FormulaU = "4.08 pt"
Application.ActiveWindow.Page.shapes.ItemFromID(10).CellsSRC(visSectionObject, visRowLine, visLineWeight).FormulaU = "4.08 pt"
Application.ActiveWindow.Page.shapes.ItemFromID(6).CellsSRC(visSectionObject, visRowLine, visLineColor).FormulaU = "2"
Application.ActiveWindow.Page.shapes.ItemFromID(9).CellsSRC(visSectionObject, visRowLine, visLineColor).FormulaU = "2"
Application.ActiveWindow.Page.shapes.ItemFromID(10).CellsSRC(visSectionObject, visRowLine, visLineColor).FormulaU = "2"
Application.EndUndoScope UndoScopeID1, True
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|