共用方式為


Visio (的 Selection.Group 方法)

會將選取範圍中所選的物件群組起來,或是將圖形轉換成群組。

語法

運算式

表達 代表 Selection 物件的變數。

傳回值

圖形

範例

下列範例會示範如何將 Shape 物件群組起來。

 
Public Sub Group_Example() 
 
 Dim vsoShape1 As Visio.Shape 
 Dim vsoShape2 As Visio.Shape 
 Dim vsoGroupShape As Visio.Shape 
 Dim vsoSelection As Visio.Selection 
 
 'Draw two rectangles. 
 Set vsoShape1 = ActivePage.DrawRectangle(1, 2, 2, 1) 
 Set vsoShape2 = ActivePage.DrawRectangle(1, 4, 2, 3) 
 
 'Deselect all shapes, and then select the two rectangles. 
 Set vsoSelection = ActiveWindow.Selection 
 vsoSelection.Select vsoShape1, visDeselectAll + visSelect 
 vsoSelection.Select vsoShape2, visSelect 
 
 'Group the rectangles into a group shape. 
 Set vsoGroupShape = vsoSelection.Group 
 
End Sub

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應