DeleteSection Method [Visio 2003 SDK Documentation]

Deletes a ShapeSheet section.

object**.DeleteSection**section

object     Required. An expression that returns a Shape object.

section     Required Integer. The index of the section to delete.

Version added

2.0

Remarks

When you delete a ShapeSheet section, all rows in the section are automatically deleted. If the specified section does not exist, nothing is deleted and no error is generated.

If a Geometry section is deleted, any subsequent Geometry sections shift up because they are indexed and no gaps can exist in an indexed range.

You can delete any section except the section represented by visSectionObject (although you can delete rows within that section).

Section index values are declared in the Visio type library in VisSectionIndices.

Example

The following macro shows how to delete a ShapeSheet section.

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  

Applies to | Shape object

See Also | AddSection method