Locking Groups withVBA 
Author Message
 Locking Groups withVBA

Is it possible to lock groups with VBA?  Documentation in
developers reference and msdn seem to say I can only do
this thru the shapesheet, but I'd like to be able to lok
groups as they are created thru automation.

TIA,

Laurie



Sun, 18 Jan 2004 03:20:07 GMT  
 Locking Groups withVBA
If it can be done through the shapesheet, it can also be done through VBA.
The following routine will list the value of the lock group cell in all the
shapes on the page.

Public Sub LockGroup()
Dim shpObj As Visio.Shape
Dim ShpNo As Integer
Dim LockGroup As Integer

Debug.Print Visio.ActivePage.Shapes.Count

For ShpNo = 1 To Visio.ActivePage.Shapes.Count
    Set shpObj = Visio.ActivePage.Shapes(ShpNo)
    LockGroup = shpObj.CellsSRC(Visio.visSectionObject, visRowLock,
visLockGroup).Result(Visio.visNone)
    Debug.Print shpObj.Name; " "; LockGroup
Next ShpNo

End Sub

John...    Visio MVP

Need stencils or ideas? http://www.magma.ca/~lancucki/Visio3rdparty.htm
Need VBA examples?   http://www.magma.ca/~lancucki/Visio_VBA_Information.htm


Quote:
> Is it possible to lock groups with VBA?  Documentation in
> developers reference and msdn seem to say I can only do
> this thru the shapesheet, but I'd like to be able to lok
> groups as they are created thru automation.

> TIA,

> Laurie



Sun, 18 Jan 2004 05:10:25 GMT  
 Locking Groups withVBA
Unfortunately, that routine doesn't help me.  I'm creating
the shapes and then grouping them, therefore I already
know that the shapes are not locked against ungrouping.  I
want to make them so they cannot be ungrouped by users,
preferably without having to go into the shapesheet for
each one and changing the 0 to a 1.

Quote:
>-----Original Message-----
>If it can be done through the shapesheet, it can also be
done through VBA.
>The following routine will list the value of the lock

group cell in all the
Quote:
>shapes on the page.

>Public Sub LockGroup()
>Dim shpObj As Visio.Shape
>Dim ShpNo As Integer
>Dim LockGroup As Integer

>Debug.Print Visio.ActivePage.Shapes.Count

>For ShpNo = 1 To Visio.ActivePage.Shapes.Count
>    Set shpObj = Visio.ActivePage.Shapes(ShpNo)
>    LockGroup = shpObj.CellsSRC(Visio.visSectionObject,
visRowLock,
>visLockGroup).Result(Visio.visNone)
>    Debug.Print shpObj.Name; " "; LockGroup
>Next ShpNo

>End Sub

>John...    Visio MVP

>Need stencils or ideas?

http://www.magma.ca/~lancucki/Visio3rdparty.htm
Quote:
>Need VBA examples?  

http://www.magma.ca/~lancucki/Visio_VBA_Information.htm

- Show quoted text -

Quote:


message

>> Is it possible to lock groups with VBA?  Documentation
in
>> developers reference and msdn seem to say I can only do
>> this thru the shapesheet, but I'd like to be able to lok
>> groups as they are created thru automation.

>> TIA,

>> Laurie

>.



Mon, 19 Jan 2004 05:04:58 GMT  
 Locking Groups withVBA
To set the value for the shape to locked:

Dim celObj As Visio.Cell

Set celObj = shpObj.CellsSRC(Visio.visSectionObject, visRowLock,
visLockGroup)
celObj.Formula = 1

John...    Visio MVP

Need stencils or ideas? http://www.magma.ca/~lancucki/Visio3rdparty.htm
Need VBA examples?   http://www.magma.ca/~lancucki/Visio_VBA_Information.htm


Quote:
> Unfortunately, that routine doesn't help me.  I'm creating
> the shapes and then grouping them, therefore I already
> know that the shapes are not locked against ungrouping.  I
> want to make them so they cannot be ungrouped by users,
> preferably without having to go into the shapesheet for
> each one and changing the 0 to a 1.

> >-----Original Message-----
> >If it can be done through the shapesheet, it can also be
> done through VBA.
> >The following routine will list the value of the lock
> group cell in all the
> >shapes on the page.

> >Public Sub LockGroup()
> >Dim shpObj As Visio.Shape
> >Dim ShpNo As Integer
> >Dim LockGroup As Integer

> >Debug.Print Visio.ActivePage.Shapes.Count

> >For ShpNo = 1 To Visio.ActivePage.Shapes.Count
> >    Set shpObj = Visio.ActivePage.Shapes(ShpNo)
> >    LockGroup = shpObj.CellsSRC(Visio.visSectionObject,
> visRowLock,
> >visLockGroup).Result(Visio.visNone)
> >    Debug.Print shpObj.Name; " "; LockGroup
> >Next ShpNo

> >End Sub

> >John...    Visio MVP

> >Need stencils or ideas?
> http://www.magma.ca/~lancucki/Visio3rdparty.htm
> >Need VBA examples?
> http://www.magma.ca/~lancucki/Visio_VBA_Information.htm


> message

> >> Is it possible to lock groups with VBA?  Documentation
> in
> >> developers reference and msdn seem to say I can only do
> >> this thru the shapesheet, but I'd like to be able to lok
> >> groups as they are created thru automation.

> >> TIA,

> >> Laurie

> >.



Mon, 19 Jan 2004 06:51:27 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. ActiveX project locks up project group

2. Grouping Tool Windows: tab group or tiled group

3. Stopping data from being grouped by Group 1 when that group is suppressed

4. HELP: Lock on Num Lock?

5. Custom Locking code for Database Locked in VB4 with Access 2.0 - HELPPPPPP

6. Shift Lock/Num Lock

7. VB4 Install locked up, Setup wiz locked up.

8. Locked textboxes are not fully locked !!

9. Add a new item also locked with optimistic locking

10. How to lock and detect the locked record?

11. Record Locking - Is there a way to test to see if a record has been locked

12. Setting Num Lock and Caps Lock key states

 

 
Powered by phpBB® Forum Software