Application.SaveSheetSelection 方法 (Project)
保存所选择工作表视图的行和列信息。
语法
expression。 SaveSheetSelection
expression:表示 Application 对象的变量。
返回值
Boolean
示例
下面的示例演示了 SaveSheetSelection 和 RestoreSheetSelection 的工作原理。
Sub SelectionDemo()
'1) In your sheet view, make column/row/cell selections, then run this
'2) macro which toggles the Project Guide display state, and
' clears the ActiveSelection (saved via Application.SaveSheetSelection).
'3) The macro then restores the ActiveSelection via Application.RestoreSheetSelection
'Save the ActiveSelection in the active sheet view
Application.SaveSheetSelection
'Toggle the Project Guide display state
Dim boolPGON As Boolean
boolPGON = Application.DisplayProjectGuide
If boolPGON = True Then
Application.DisplayProjectGuide = False
Else
Application.DisplayProjectGuide = True
End If
MsgBox "The Project Guide display state has been toggled. " _
& "Notice that your active selection was cleared in the " _
& "process." & Chr(10) & Chr(10) _
& "Now the call to RestoreSheetSelection restores the ActiveSelection...", _
vbOKOnly
Application.RestoreSheetSelection
End Sub
支持和反馈
有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。