remove shape protection

Started by perry59, November 30, 2010, 10:13:04 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

perry59

is there a way, via vba, to remove all protection on all shapes on a drawing?
Thanks
what, me worry?

Paul Herber

The answer has to be yes and no.
Yes, it is possible, with VBA to iterate through all pages, all shapes on those pages (and recurse through grouped shapes) removing all the protection attributes.
However ...

  • if shapes have protection it is usually for some purpose
  • removing the protection might break the shape
  • some aspects of a shape can be protected in ways that cannot easily be removed without a deep understanding of cell formulas, i.e. guarded values/formula.



Electronic and Electrical engineering, business and software stencils for Visio -

https://www.paulherber.co.uk/

perry59

Gotta love those "yes & no" answers!
I guess I dont need to remove ALL protection...
my problem is I need to modify a bunch of old drawings, meaning mostly a lot of cut&paste and moving things about. Its getting REALLY annoying to paste a group of objects into a new drawing, move the highlighted objects into place and find a bunch of lines  going out into space because someone put protection on and end point or something like that. Then I have to do and "undo" to put the objects back where they were, pick out the lines that had some type of movement protection, unprotect them then move them all where I want them. Its taking way to much time to do a simple task. >:(
Thats why I was hoping I could find a bit of code here that would at least get me a start on a macro to remove some of the protections on every object in a drawing.
what, me worry?

Paul Herber

Ok, in that case you don't really need VBA at all.
Select all shapes (Control-A), menu Format -> Protection -> None -> OK.
Repeat for each page.
Electronic and Electrical engineering, business and software stencils for Visio -

https://www.paulherber.co.uk/

perry59

That was the first thing I tried, it dont work.
I select all on the page, go to menu->format, all the boxes are clear.
I move my selection (or mirror, etc), lines are all wacked out.
I select the wacked line, menu->format and its got protection on x, or y, etc.
The selection may not have protection, but individual items may...
what, me worry?

Paul Herber

Do you mean that it has a guarded formula?
Electronic and Electrical engineering, business and software stencils for Visio -

https://www.paulherber.co.uk/

perry59

I dont even know what a "guarded" formula is, and I dont think there is anyone at my work who is visio enough to do that.
When I select the individual entities, I can remove the protection from them as stated above.
what, me worry?

Visio Guy

Hmm, I wonder if we have shapes on locked layers, or a protected document?

Bring up the Document Explorer window, right-click on the drawing node and choose Protect Document. Uncheck any items that happen to be checked.
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

wapperdude

Any possiblity that you could provide a Visio file example?
Visio 2019 Pro

perry59

Sorry I took so long, been doing other chores ::)

The objects are not on locked layers, neither is the document protected.
I will look for something I can send in, will take a while, proprietary stuff.
thanks
what, me worry?

perry59

Ok, here's a small sample. (sorry I took so long, been busy!)
If you select everything on the page, then right click and go to protection, it says that the selection is unprotected. If you then move the selection (say out of the page so you can see it more clearly), some of the items move and others dont. If you then select the items that did not move, you find that they have some x or y protection on them. There are no layers in the drawing, and the drawing itself is not protected.
Thats why I'm looking for an "unprotect all" macro, to get rid of these kinds of headaches!
what, me worry?

wapperdude

The problem is with selecting all shapes.  Visio decides which is the 1st shape selected and then adds the other shapes to the selection group.  If the 1st chosen has no protection issues, then, it would appear that none of the selections have any problems.  Obviously, that isn't necessarily true.

One work around would be to 1st apply all protections to the selection, and then apply no protections.  This will remove any and all protections from the selected group.  You are now free to move about the drawing.

Wapperdude
Visio 2019 Pro

perry59

A good tip Wapper
thanks for the info  ;D
what, me worry?

deweyswak

I need to do the same thing - remove shape protection from a 2010 monthly calendar so I can turn it into a 2011 monthly calendar.  Sadly there isn't a 2011 Visio monthly calendar format on microsoft online yet.  I tried ctrl+A, Format...protection...turn on for all, turn it off.  But still when I try to edit the text box, error msg says "shape protection and/or layer properties prevent complete execution of this command."  I don't want to have to edit the protection for every cell, 365 for the whole year.  There must be a way to remove this for the entire calendar.  ideas?  thanks.

deweyswak

never mind.  I thought, why go to all this trouble!  I'll just create new 2011 calendars in Visio using the calendar shape.