Author Topic: remove shape protection  (Read 70096 times)

0 Members and 2 Guests are viewing this topic.

perry59

  • Jr. Member
  • **
  • Posts: 34
remove shape protection
« on: November 30, 2010, 05:13:04 PM »
is there a way, via vba, to remove all protection on all shapes on a drawing?
Thanks

Get Visio Guy's new book!


Paul Herber

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2042
    • Sandrila Ltd
Re: remove shape protection
« Reply #1 on: November 30, 2010, 10:06:08 PM »
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.



Engineering, business and software stencils and applications for Visio - http://www.sandrila.co.uk/
Twitter: http://twitter.com/sandrilaLtd

Visit the Visio Guy web site at www.visguy.com for hundreds more articles on Visio!


perry59

  • Jr. Member
  • **
  • Posts: 34
Re: remove shape protection
« Reply #2 on: December 01, 2010, 12:21:44 PM »
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.

Paul Herber

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2042
    • Sandrila Ltd
Re: remove shape protection
« Reply #3 on: December 01, 2010, 12:28:09 PM »
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.
Engineering, business and software stencils and applications for Visio - http://www.sandrila.co.uk/
Twitter: http://twitter.com/sandrilaLtd


perry59

  • Jr. Member
  • **
  • Posts: 34
Re: remove shape protection
« Reply #4 on: December 01, 2010, 04:57:46 PM »
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...

Paul Herber

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2042
    • Sandrila Ltd
Re: remove shape protection
« Reply #5 on: December 01, 2010, 05:12:11 PM »
Do you mean that it has a guarded formula?
Engineering, business and software stencils and applications for Visio - http://www.sandrila.co.uk/
Twitter: http://twitter.com/sandrilaLtd


perry59

  • Jr. Member
  • **
  • Posts: 34
Re: remove shape protection
« Reply #6 on: December 02, 2010, 11:27:39 AM »
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.

Visio Guy

  • Administrator
  • Hero Member
  • *****
  • Posts: 1403
  • Smart Graphics for Visual People...n' Stuff
    • Visio Guy
Re: remove shape protection
« Reply #7 on: December 02, 2010, 02:34:29 PM »
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 new Visio Book! Using Microsoft Visio 2010

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1593
  • Ideas Visio-lized into solutions
Re: remove shape protection
« Reply #8 on: December 02, 2010, 09:39:19 PM »
Any possiblity that you could provide a Visio file example?

perry59

  • Jr. Member
  • **
  • Posts: 34
Re: remove shape protection
« Reply #9 on: December 09, 2010, 04:40:42 PM »
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

perry59

  • Jr. Member
  • **
  • Posts: 34
Re: remove shape protection
« Reply #10 on: December 16, 2010, 01:06:04 PM »
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!

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1593
  • Ideas Visio-lized into solutions
Re: remove shape protection
« Reply #11 on: December 16, 2010, 03:13:50 PM »
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

perry59

  • Jr. Member
  • **
  • Posts: 34
Re: remove shape protection
« Reply #12 on: December 16, 2010, 04:30:37 PM »
A good tip Wapper
thanks for the info  ;D

deweyswak

  • Newbie
  • *
  • Posts: 2
Re: remove shape protection from a master calendar template
« Reply #13 on: December 16, 2010, 05:24:54 PM »
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

  • Newbie
  • *
  • Posts: 2
Re: remove shape protection on a calendar
« Reply #14 on: December 16, 2010, 05:39:36 PM »
never mind.  I thought, why go to all this trouble!  I'll just create new 2011 calendars in Visio using the calendar shape.