I am tying to make heads and tails out of the following VBA Example and make it useful for powershell.
http://msdn.microsoft.com/en-us/library/office/ff769170.aspx
What I want to do is group some named shapes once i have created them on the page.
Here is my first pass. It does not work and I am confused on why? Can anyone assist me?
$visio = New-VisioApplication
#Open an existing template
$ftdr_template = Open-VisioDocument "c:\temp\yourvsdtemplate.vst"
#open a stencil
$ftdr_stencil = Open-VisioDocument c:\temp\visio\dynamic\ftdr_stencil.vss
$master1 = Get-VisioMaster "master.21" $ftdr_stencil
$Shape1 = New-VisioShape $master1 -Points 4,5.2
$master2 = Get-VisioMaster "master.22" $ftdr_stencil
$Shape2 = New-VisioShape $master1 -Points 6,5.2
$Selection = Get-VisioPage -ActivePage
$Selection = $shape1, $visDeselectAll + $visSelect
$Selection = $shape2, $visSelect
$groupshape = $Selection.group
With VisioPS it works like this:
Import-Module VisioPS
$visio = New-VisioApplication
$doc = New-VisioDocument
$stencil = Open-VisioDocument "basic_u.vss"
$master1 = Get-VisioMaster "Rounded Rectangle" $stencil
#Drop multiple shapes at the same time
$shapes = New-VisioShape $master1 -Points 1,5.2,3,5.2,5,5.2
#Ensure that Nothing is Selected - just to demonstrate this feature
Select-VisioShape -Operation None
#Select the first and third shapes dropped
Select-VisioShape -Shapes $shapes[0],$shapes[2]
# Group the selected shapes
$g1 = New-VisioGroup
# Ungroup them
Remove-VisioGroup -Shapes $g1
# Group by specifying the shapes (ignore whatever is selected)
$g1 = New-VisioGroup -Shapes $shapes[0],$shapes[1]