So helpful, and just what I needed! Thanks for sharing this. I've created a complicated network diagram. This is perfect for isolating how data moves through the system.
Same here. I'm needing to separate backhaul on my network map without having to jump back and forth between different maps. Would like an easier solution but this will definitely help.
Jens. Sorry but I do not have anything on radio buttons. My Visio videos were created several years ago. I have since retired and have not touched Visio since then, so I'm afraid there's nothing new in the pipeline.
Wonderfull, this is exactly what I was looking for. Thank you! Can you ore someone maybe post the macro-codes here? I couldn't read the writing because it was very blurry on my screen.
Sub LayerToggle(ItemNbr As Integer, OnOff As String) 'Enable diagram services Dim DiagramServices As Integer DiagramServices = ActiveDocument.DiagramServicesEnabled ActiveDocument.DiagramServicesEnabled = visServiceVersion140 Dim UndoScopeID1 As Long UndoScopeID1 = Application.BeginUndoScope("Layer Properties") Dim vsoLayer1 As Visio.Layer Set vsoLayer1 = Application.ActiveWindow.Page.Layers.Item(ItemNbr) vsoLayer1.CellsC(visLayerVisible).FormulaU = OnOff Application.EndUndoScope UndoScopeID1, True 'Restore diagram services ActiveDocument.DiagramServicesEnabled = DiagramServices End Sub
If you look in the comments below, about 1 year ago Barnaby Arnott posted some suggestions for improvements. You might try incorporating his suggestions. In the replies to Barnaby's post, Saber Dokmak posted that he was experiencing a run time error, but he later updated to say the problem was "the caption wasn't the same".
This was awesome. I had to tweak mine by adding a .Value before the Then statement. One thing though, I've created a second tab called 'option 2' this tab has some of the same objects and flows as my first tab 'option 1' I'm trying to create another macro to use some of the same 'check boxes' but can't seem to create another macro. I tried using the same macro and Visio Objects (Private Sub) and just add my new IF statements to the new flows but that doesn't seem to work. Any chance you could point me to some documentation on doing what you did in this video but across multiple tabs? Or say adding a 3rd shape but on a different tab and adding an additional check box on tab 2? Either way, this was grrreat! Thanks!!
Thanks for watching, and for leaving a comment. I'm glad you found it useful. I hadn't thought about trying to do it across multiple layers, but now you've planted that idea I will play around and see what I can come up with. Stay tuned, but don't hold your breath because it might be a while before I can get around to it.
I found that the layers changes the box fill color and text to the layer color assigned. Is there a way to have it only change the fill color but keep the text black?
Mark, you should be able to add code to set the color of the text. If, like me, you're not a VBA coder, then you could use the same technique I used to figure out what the code looks like. Create a macro and use Visio to change the text color, and then go into the macro editor to examine your code. In principal you should be able to change any of the properties of the object in the module when you toggle a layer on or off.
Just what I was looking for! :) Let me suggest some improvements to fill the gaps you admitted to: Just pass the Checkbox's 'Value' property to avoid the If statement And if you set the Caption to match the layer's name, you can just pass that. Substitute "##" below with your layer name. (If you don't like this, maybe look at using the Data1 or GroupName properties of the Checkbox to populate the related layer's name) Private Sub ToggleLayer_##_Click() Call LayerToggle(ToggleLayer_##.Caption, ToggleLayer_##.Value) End Sub Sub LayerToggle(LayerName As String, Checked As String) ' Used by checkboxes to toggle visible layers 'Enable diagram services Dim DiagramServices As Integer DiagramServices = ActiveDocument.DiagramServicesEnabled ActiveDocument.DiagramServicesEnabled = visServiceVersion140 + visServiceVersion150 Dim UndoScopeID1 As Long UndoScopeID1 = Application.BeginUndoScope("Layer Properties") Dim vsoLayerToToggle As Visio.Layer Set vsoLayerToToggle = Application.ActiveWindow.Page.Layers.Item(LayerName) vsoLayerToToggle.CellsC(visLayerVisible).FormulaU = Checked Application.EndUndoScope UndoScopeID1, True 'Restore diagram services ActiveDocument.DiagramServicesEnabled = DiagramServices End Sub
Doesn't really work for me, it says runtime error. .Item() seems to only read integers. Would be cool to get your code working though but I'll stick to the original code in the vid for now. Thank you both so much and appreciate any further help :) **UPDATE**: I managed to fix my issue, the caption wasn't the same, now it works!
I afraid I can't help, I'm not even sure what you mean by Actions. I created this video several years ago when I was still working regularly with Visio. I've been retired for a while, and I haven't touched it since then, so I'm rather out of touch now.
Thanks for that Mick. Good to know. I assumed there must be a way, but as I said in the video, I'm just feeling my way around. I'm definitely not a VBA coder.
I'm sorry but I can't tell if your post is intended to be a genuine question or a criticism. In either case, I agree with you that it would be a pain to do it this way for a large number of layers. If it's a question, then I would add, "I do say somewhere in the video that I'm not a VBA programmer. I'm just a guy who found a way to do something neat and wanted to share it. If it doesn't work for you, that's a pity, but judging by some of the comments I've received, other people have found it useful, therefore I feel it was worthwhile publishing it. If it's a criticism... Fair point. Constructive criticism is always welcome. How would you suggest it should be done?
Is there a limit on the number of instances in which you can do this? I've had success replicating your techniques to apply 6 different layers onto 2 different pages within Visio 2016. However, once I apply them to a third or fourth page(tab), the entire process ceases to be applicable. The coding appears to be the same from page 2 to page 3, but it's just like the formula just doesn't work anymore. Scratching my head here. Any thoughts on the matter that you could possibly assist me with? Anyone?
I've never tried doing it on multiple pages, so I'm afraid I don't have a ready answer. About a year ago, another viewer (J Morton) reported a similar problem. I intended to investigate further, but never got around to it. (My schedule has been rather full for a long while.) Perhaps someone else has an answer???
After playing around with it a bit further, I was able to find a work around. Visio 2016 has enough bugs as it is already, but I proceeded under the notion that the macros themselves may have had a limit to the number of shapes utilizing their individual coding. I ended up creating multiple macros to accommodate the many shapes and layers as opposed to simply relying on just the one. Seems to work well at this point.
That's strange because it comes across loud and clear when I play it back. Tried it on the laptop on which I created it, a different laptop, and on my phone. All sounds good to me.
Loved it. Made my day. Thanks 🙂
It’s as if Timothy Dalton (James Bond) were teaching Visio! Nice work sir!
Very well done! Thank you for this concise and action-packed tutorial!
Great tutorial - very useful for complex network diagrams!
Thanks a lot, done and working really well 👍
Easy to follow, gets the job done. Looking forward to more as this was a much simpler approach then a previous button type approach I used. Thank you.
So helpful, and just what I needed! Thanks for sharing this. I've created a complicated network diagram. This is perfect for isolating how data moves through the system.
Same here. I'm needing to separate backhaul on my network map without having to jump back and forth between different maps. Would like an easier solution but this will definitely help.
Very good - thank you. Do you have a short demo with radio buttons too? How to group them and to get the status back?
Jens. Sorry but I do not have anything on radio buttons. My Visio videos were created several years ago. I have since retired and have not touched Visio since then, so I'm afraid there's nothing new in the pipeline.
Owe you a big thank you!
Wonderfull, this is exactly what I was looking for. Thank you!
Can you ore someone maybe post the macro-codes here? I couldn't read the writing because it was very blurry on my screen.
Sub LayerToggle(ItemNbr As Integer, OnOff As String)
'Enable diagram services
Dim DiagramServices As Integer
DiagramServices = ActiveDocument.DiagramServicesEnabled
ActiveDocument.DiagramServicesEnabled = visServiceVersion140
Dim UndoScopeID1 As Long
UndoScopeID1 = Application.BeginUndoScope("Layer Properties")
Dim vsoLayer1 As Visio.Layer
Set vsoLayer1 = Application.ActiveWindow.Page.Layers.Item(ItemNbr)
vsoLayer1.CellsC(visLayerVisible).FormulaU = OnOff
Application.EndUndoScope UndoScopeID1, True
'Restore diagram services
ActiveDocument.DiagramServicesEnabled = DiagramServices
End Sub
@@10mins Thank you! Very kind :)
@@Inkoknyto You are welcome.
Great Training Video! Well Planned out, good voice. Thanks for sharing
Thank You, save my day !
I'm glad I could help.
That was very helpful. Thank you!
Great video, Great spirit! Thank you very much.
thank you for the video. I am getting run time error, i follow all your steps. any advise?
If you look in the comments below, about 1 year ago Barnaby Arnott posted some suggestions for improvements. You might try incorporating his suggestions. In the replies to Barnaby's post, Saber Dokmak posted that he was experiencing a run time error, but he later updated to say the problem was "the caption wasn't the same".
@@10mins thank you I just tried again using your instructions and it worked for me! I may have done something wrong last time :). Thank you!!!
@@tmanoharanify I'm pleased to hear you resolved your problem.
How to display the object or shape name in text by just only click at the shape ?
This was awesome. I had to tweak mine by adding a .Value before the Then statement. One thing though, I've created a second tab called 'option 2' this tab has some of the same objects and flows as my first tab 'option 1' I'm trying to create another macro to use some of the same 'check boxes' but can't seem to create another macro. I tried using the same macro and Visio Objects (Private Sub) and just add my new IF statements to the new flows but that doesn't seem to work. Any chance you could point me to some documentation on doing what you did in this video but across multiple tabs? Or say adding a 3rd shape but on a different tab and adding an additional check box on tab 2? Either way, this was grrreat! Thanks!!
Thanks for watching, and for leaving a comment. I'm glad you found it useful. I hadn't thought about trying to do it across multiple layers, but now you've planted that idea I will play around and see what I can come up with. Stay tuned, but don't hold your breath because it might be a while before I can get around to it.
I found that the layers changes the box fill color and text to the layer color assigned. Is there a way to have it only change the fill color but keep the text black?
Mark, you should be able to add code to set the color of the text. If, like me, you're not a VBA coder, then you could use the same technique I used to figure out what the code looks like. Create a macro and use Visio to change the text color, and then go into the macro editor to examine your code. In principal you should be able to change any of the properties of the object in the module when you toggle a layer on or off.
Just what I was looking for! :)
Let me suggest some improvements to fill the gaps you admitted to:
Just pass the Checkbox's 'Value' property to avoid the If statement
And if you set the Caption to match the layer's name, you can just pass that. Substitute "##" below with your layer name. (If you don't like this, maybe look at using the Data1 or GroupName properties of the Checkbox to populate the related layer's name)
Private Sub ToggleLayer_##_Click()
Call LayerToggle(ToggleLayer_##.Caption, ToggleLayer_##.Value)
End Sub
Sub LayerToggle(LayerName As String, Checked As String)
' Used by checkboxes to toggle visible layers
'Enable diagram services
Dim DiagramServices As Integer
DiagramServices = ActiveDocument.DiagramServicesEnabled
ActiveDocument.DiagramServicesEnabled = visServiceVersion140 + visServiceVersion150
Dim UndoScopeID1 As Long
UndoScopeID1 = Application.BeginUndoScope("Layer Properties")
Dim vsoLayerToToggle As Visio.Layer
Set vsoLayerToToggle = Application.ActiveWindow.Page.Layers.Item(LayerName)
vsoLayerToToggle.CellsC(visLayerVisible).FormulaU = Checked
Application.EndUndoScope UndoScopeID1, True
'Restore diagram services
ActiveDocument.DiagramServicesEnabled = DiagramServices
End Sub
Thank you for your input Barnaby. That's very helpful. I appreciate you taking the time to spell it out.
Doesn't really work for me, it says runtime error. .Item() seems to only read integers. Would be cool to get your code working though but I'll stick to the original code in the vid for now. Thank you both so much and appreciate any further help :)
**UPDATE**: I managed to fix my issue, the caption wasn't the same, now it works!
I want to do this in Actions, can you assist with that?
I afraid I can't help, I'm not even sure what you mean by Actions. I created this video several years ago when I was still working regularly with Visio. I've been retired for a while, and I haven't touched it since then, so I'm rather out of touch now.
The layer can be accessed by name for example ...
Set vsoLayer = ActivePage.Layers.Item("LayerName")
Thanks for that Mick. Good to know. I assumed there must be a way, but as I said in the video, I'm just feeling my way around. I'm definitely not a VBA coder.
How is this going to help if you have 200 layers? All these lines of coding?
I'm sorry but I can't tell if your post is intended to be a genuine question or a criticism. In either case, I agree with you that it would be a pain to do it this way for a large number of layers.
If it's a question, then I would add, "I do say somewhere in the video that I'm not a VBA programmer. I'm just a guy who found a way to do something neat and wanted to share it. If it doesn't work for you, that's a pity, but judging by some of the comments I've received, other people have found it useful, therefore I feel it was worthwhile publishing it.
If it's a criticism... Fair point. Constructive criticism is always welcome. How would you suggest it should be done?
Appreciate your time sharing this +1
Is there a limit on the number of instances in which you can do this? I've had success replicating your techniques to apply 6 different layers onto 2 different pages within Visio 2016. However, once I apply them to a third or fourth page(tab), the entire process ceases to be applicable. The coding appears to be the same from page 2 to page 3, but it's just like the formula just doesn't work anymore. Scratching my head here. Any thoughts on the matter that you could possibly assist me with? Anyone?
I've never tried doing it on multiple pages, so I'm afraid I don't have a ready answer. About a year ago, another viewer (J Morton) reported a similar problem. I intended to investigate further, but never got around to it. (My schedule has been rather full for a long while.)
Perhaps someone else has an answer???
After playing around with it a bit further, I was able to find a work around. Visio 2016 has enough bugs as it is already, but I proceeded under the notion that the macros themselves may have had a limit to the number of shapes utilizing their individual coding. I ended up creating multiple macros to accommodate the many shapes and layers as opposed to simply relying on just the one. Seems to work well at this point.
Interesting. I've never stress tested any of the macros I've built, so I wasn't aware of this limitation. Thanks for sharing your findings.
Audio is too low. Normalize the audio first before uploading to UA-cam.
That's strange because it comes across loud and clear when I play it back. Tried it on the laptop on which I created it, a different laptop, and on my phone. All sounds good to me.