共用方式為


Project) (Application.RestoreSheetSelection 方法

會還原選取之工作表檢視中已儲存的列和欄資訊。

語法

expressionRestoreSheetSelection

expression 代表 Application 物件的變數。

傳回值

布林值

範例

下列範例會示範 SaveSheetSelectionRestoreSheetSelection 的運作方式。

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 支援與意見反應