在Visio VBA中通过“偏移”功能选择新生成的形状

我是VBA中的绝对新手。我想通过Visio VBA中的Offset函数选择新生成的形状。

Sub Offset_Example()
 Dim sel As Visio.Selection
Set sel = activeWindow.Selection
 sel.Offset 0.06
End Sub

在Visio VBA中通过“偏移”功能选择新生成的形状

mirror_cat 回答:在Visio VBA中通过“偏移”功能选择新生成的形状

经过长时间的尝试和错误,我在偏移功能前后计算了页面上的形状,然后选择了最后添加的形状索引

Public Sub makeborder()

Dim intCounter As Integer
Dim intShapeCount As Integer
Dim intShapeCount2 As Integer
Dim vsoShapes As Visio.Shapes
Dim vsoShapes2 As Visio.Shapes
Dim vsoSelection As Visio.Selection

Set vsoShapes = ActivePage.Shapes

intShapeCount = vsoShapes.Count

Application.ActiveWindow.Selection.Offset 0.045
Set vsoShapes2 = ActivePage.Shapes
intShapeCount2 = vsoShapes2.Count
ActiveWindow.DeselectAll
Set vsoSelection = ActiveWindow.Selection
For intCounter = intShapeCount + 1 To intShapeCount2
vsoSelection.Select vsoShapes(intCounter),visSelect
Next intCounter

vsoSelection.Union

End Sub
本文链接:https://www.f2er.com/2997601.html

大家都在问