Examples: ExpandAllSections method
This script expands the sections in a document if the user switches to Edit mode and collapses them if the user switches to Read mode.
Sub Postmodechange(Source As Notesuidocument)
If source.EditMode Then
Call source.ExpandAllSections
Else
Call source.CollapseAllSections
End If
End Sub