會從 ShapeSheet 試算表的區段中移除資料列。
語法
expression。
DeleteRow( _Section_ , _Row_ )
expression 一個用於表示 Shape 物件的變數。
參數
| 名稱 | 必要/選用 | 資料類型 | 描述 |
|---|---|---|---|
| Section | 必要 | 整數 | 包含列之區段的索引。 |
| Row | 必要 | 整數 | 要刪除之列的索引。 |
傳回值
無
註解
若要每次從 ShapeSheet 區段移除一個資料列,請使用 DeleteRow 方法。 如果區段有索引資料列,在刪除資料列之後的列會移動位置。 如果該資料列不存在,則不會刪除任何資料列。
你不應該刪除定義形狀基本特徵的列,例如 visRowXForm1D) (的 1D 端點列,或 visRowComponent) (的元件列,或 Geometry 區段中 visRowVertex + 0) (MoveTo 列。 您無法刪除由 visSectionCharacter、visSectionParagraph 及 visSectionTab 所代表之區段中的資料列。
範例
下列 Microsoft Visual Basic for Applications (VBA) 巨集會示範如何使用 DeleteRow 方法來刪除 ShapeSheet 資料列。
Public Sub DeleteRow_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
'Add a row to the scratch section.
vsoShape.AddRow visSectionScratch, visRowScratch, 0
'Delete the row from the scratch section.
vsoShape.DeleteRow visSectionScratch, visRowScratch
End Sub
支援和意見反應
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。