共用方式為


Shape.DeleteSection 方法 (Visio)

會刪除 ShapeSheet 區段。

語法

expressionDeleteSection( _Section_ )

表達 代表 Shape 物件的變數。

參數

名稱 必要/選用 資料類型 描述
Section 必要 Integer 要刪除之區段的索引。

傳回值

註解

當您刪除 ShapeSheet 區段時,會自動刪除該區段中的所有資料列。 如果指定的區段不存在,則不會刪除任何區段,並且不會產生任何錯誤。

如果刪除 Geometry 區段,任何隨後的 Geometry 區段會向上移動,因為這些是索引區段,而且在索引範圍中不能有任何間距。

除了 visSectionObject (雖然您可以刪除該區段中的資料列) 所代表的區段,您可以刪除任何其他區段。

區段索引值是在 VisSectionIndices 的 Visio型別程式庫中宣告。

範例

下列 Microsoft Visual Basic for Applications (VBA) 巨集會示範如何刪除 ShapeSheet 區段。

Public Sub DeleteSection_Example() 
 
 Dim vsoPage As Visio.Page 
 Dim vsoShape As Visio.Shape 
 
 'Get the active page. 
 Set vsoPage = ActivePage 
 
 'If there isn't an active page, set the Page object 
 'to the first page of the active document. 
 If vsoPage Is Nothing Then 
 Set vsoPage = ActiveDocument.Pages(1) 
 End If 
 
 'Draw a rectangle on the active page. 
 Set vsoShape = vsoPage.DrawRectangle(1, 5, 5, 1) 
 
 'Add a scratch section to the ShapeSheet of the rectangle. 
 vsoShape.AddSection visSectionScratch 
 
 'Delete the scratch section from the ShapeSheet. 
 vsoShape.DeleteSection visSectionScratch 
 
End Sub

支援和意見反應

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