Table of contents
Collapse the table of content
Expand the table of content

Shape.DeleteRow Method (Visio)

office 365 dev account|Last Updated: 6/12/2017
1 Contributor

Deletes a row from a section in a ShapeSheet spreadsheet.


expression . DeleteRow( Section , Row )

expression A variable that represents a Shape object.


NameRequired/OptionalData TypeDescription
SectionRequiredIntegerThe index of the section that contains the row.
RowRequiredIntegerThe index of the row to delete.

Return Value



To remove one row at a time from a ShapeSheet section, use the DeleteRow method. If the section has indexed rows, the rows following the deleted row shift position. If the row does not exist, nothing is deleted.

You should not delete rows that define fundamental characteristics of a shape, such as the 1-D Endpoints row ( visRowXForm1D ) or the component row ( visRowComponent ) or the MoveTo row ( visRowVertex + 0) in a Geometry section. You cannot delete rows from sections represented by visSectionCharacter , visSectionParagraph , and visSectionTab .


The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the DeleteRow method to delete a ShapeSheet row.

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
© 2018 Microsoft