Draw a shape around selection

Started by kiler40, February 09, 2015, 09:58:22 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

wapperdude

CenterYiewOnShape:  This method introduced with V2010.
Visio 2019 Pro

Yacine

Thanks, Wayne.
In this case my own submission in this post can be used. I works with V2007.
Yacine

JuneTheSecond

#32
Is it too late for " Draw a shape around selection"?

Selection.DrawRegion may be a help.



Option Explicit

Sub test()
    Dim shp As Visio.Shape
   
    Set shp = ActiveWindow.Selection.DrawRegion(0.01, visDrawRegionIncludeHidden)
    shp.Cells("LineColor").Formula = "RGB(145,205,220)"
    shp.Cells("LineWeight").Formula = "30 pt"
    shp.SendToBack
End Sub

Best Regards,

Junichi Yoda
http://june.minibird.jp/

kiler40

JuneTheSecond,
This is quite amazing :)

But i didn`t give up on CenterViewOnShape :)
Since i didn`t understood how to use it on a multiple selection i went to a stupid (maybe) but effective idea

If ActiveWindow.Selection.Count > 1 Then
        ActiveWindow.Selection.Group
        ActiveWindow.CenterViewOnShape ActiveWindow.Selection(1), visCenterViewDefault
        ActiveWindow.Selection.Ungroup
    Else
        ActiveWindow.CenterViewOnShape ActiveWindow.Selection(1), visCenterViewDefault
    End If

8)
and after that i continue with the proposal given from Yacine. The benefit there is that creates a shape that can have both fill color and line color. And  DrawRegion is giving only line ? (maybe i`m speaking stupid now...)

Andrei