Create layers for each shapes on my page

Started by Leonardo, August 23, 2017, 12:51:56 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Leonardo

Hello friends,

I would like create layers for each shapes on my page.
I've used a loop like below but it dosen't work..


Public Sub Layers()

Dim vsoShape As Visio.Shape
Dim vsoLayers As Visio.Layers
Dim i As Integer
i = 1
 
  For Each vsoShape In ActivePage.Shapes
    If vsoShape.Name Like "Square*" Then
   
Application.ActiveWindow.Page.Layers.Add ("Layer " & i)
    i = i + 1
         
     End If
  Next

End Sub


Do you have any solution ?

Thank you.
Best,

Leonardo

Surrogate

your code just create some layers, but not assign shapes to personal layers !

Leonardo

Ok,
So how do i assign layers to my shapes ?

Surrogate

i think this code can do it
Sub Layers()

Dim vsoShape As Visio.Shape
Dim vsoLayers As Visio.Layers
Dim i As Integer
' define how many layers exsist on the page
i = ActivePage.Layers.Count
 
  For Each vsoShape In ActivePage.Shapes
    If vsoShape.Name Like "Box*" Then
   
Application.ActiveWindow.Page.Layers.Add ("Layer " & i)

  vsoShape.CellsSRC(visSectionObject, visRowLayerMem, visLayerMember).FormulaForceU = Chr(34) & i & Chr(34)
     i = i + 1
     End If
  Next


End Sub

Yacine

#4
Your inquiry is quite unusual. What is the intention behind it? How do you want to use it?
If you're after hiding shapes, there are easier ways.
Yacine

Surrogate


Leonardo

Thank you!

Well, the purpose is to lock any shape from his layers.
Before post this topic, I had attributed several shapes to my layers. The problem is that when I "lock" one of my layers, the shapes associated with it are all blocked.



Surrogate

#7
As Yacine said
Quote from: Yacine on August 23, 2017, 07:44:12 PMIf you're after hiding shapes, there are easier ways.
for example as protect one or more you shapes using Protection Window
This video describe how add Developer tab, and find Protection button in ShapeDesign group
There you can find a lot of protection options

Leonardo

Oh thank you very much!

I did not know it was possible. What I wanted to do works perfectly.
This solution is much better, is easier and faster than what I wanted to do  ;D ;D

thk!  ;)

Browser ID: smf (is_webkit)
Templates: 4: index (default), Display (default), GenericControls (default), GenericControls (default).
Sub templates: 6: init, html_above, body_above, main, body_below, html_below.
Language files: 4: index+Modifications.english (default), Post.english (default), Editor.english (default), Drafts.english (default).
Style sheets: 4: index.css, attachments.css, jquery.sceditor.css, responsive.css.
Hooks called: 290 (show)
Files included: 34 - 1321KB. (show)
Memory used: 1151KB.
Tokens: post-login.
Cache hits: 12: 0.00256s for 26,580 bytes (show)
Cache misses: 1: (show)
Queries used: 14.

[Show Queries]