Hi,
I have a piece of visio code that works, but I need to run it for every single tab within a visio file. My question is: Is there a way to have the script run for an entire visio document?
Regards
Gonzalo
1. you can place that code in other visio document, which must be open when you want change target file. Use ActiveDocument instead ThisDocument
2. you can place that code in other ms office document, but there you need make some changes
3. you can create add-in with use VisualStudio
4. also you can write visual basic script, aka vbs file
I have probably not expressed myself correctly...:
Sub SomethingLikeAs()
Dim sh As Shape
For Each sh In ActivePage.Shapes
If sh.CellExists("Prop.Countreport", visExistsAnywhere) Then
If sh.Cells("Prop.Countreport").FormulaU = """ITHB""" Then sh.Cells("Fillforegnd").Formula = visDarkRed
If sh.Cells("Prop.Countreport").FormulaU = """ITHL""" Then sh.Cells("Fillforegnd").Formula = visDarkBlue
If sh.Cells("Prop.Countreport").FormulaU = """ITHH""" Then sh.Cells("Fillforegnd").Formula = visDarkGreen
If sh.Cells("Prop.Countreport").FormulaU = """ITHR""" Then sh.Cells("Fillforegnd").Formula = visDarkYellow
End If
Next
End Sub
I have to run it basically in every single page. What I want is to change it so ir runs in the entire document - including all pages in one go.
I've tried to change ActivePage to Active Document but it wouldn't provide a good result.
Any suggestions?
Thanks in advance!
Sub SomethingLikeAs()
Dim sh As Shape
Dim vp as Visio.page
for each vp in ActiveDocument.Pages
For Each sh In vp.Shapes
If sh.CellExists("Prop.Countreport", visExistsAnywhere) Then
If sh.Cells("Prop.Countreport").FormulaU = """ITHB""" Then sh.Cells("Fillforegnd").Formula = visDarkRed
If sh.Cells("Prop.Countreport").FormulaU = """ITHL""" Then sh.Cells("Fillforegnd").Formula = visDarkBlue
If sh.Cells("Prop.Countreport").FormulaU = """ITHH""" Then sh.Cells("Fillforegnd").Formula = visDarkGreen
If sh.Cells("Prop.Countreport").FormulaU = """ITHR""" Then sh.Cells("Fillforegnd").Formula = visDarkYellow
End If
Next
Next
End Sub
Thanks a lot!!! It worked perfectly.