Word) (Window 物件

代表一個視窗。 許多文件特性 (如捲軸和尺規) 實際上都是視窗的屬性。

註解

Window 物件是 Windows 集合的成員。 Application 物件的 Windows 集合包含應用程式中的所有視窗而 Document 物件的 Windows 集合都包含只顯示指定的文件的視窗。

使用 Windows (Index),其中 Index 是視窗的名稱或索引編號,可以傳回單一的 Window 物件。 下列範例會將 Document1 視窗最大化。

Windows("Document1").WindowState = wdWindowStateMaximize

索引編號是 [ 視窗] 功能表上的視窗名稱左邊的數字。 下列範例會顯示 Windows 集合中的第一個視窗的標題。

MsgBox Windows(1).Caption

使用 Add 方法或 NewWindow 方法將新的視窗新增到 Windows 集合。 下列陳述式的每個使用中視窗內建立新的文件視窗。

ActiveDocument.ActiveWindow.NewWindow 
NewWindow 
Windows.Add

開啟一個以上的文件視窗時,視窗標題中會顯示冒號 (:) 和數字。

當您切換至預覽列印檢視時,會建立新的視窗。 當您關閉預覽列印此視窗會從 Windows 集合中移除。

方法

名稱
Activate
Close
GetPoint
LargeScroll
NewWindow
PageScroll
PrintOut
RangeFromPoint
ScrollIntoView
SetFocus
SmallScroll
ToggleRibbon

屬性

名稱
Active
ActivePane
應用程式
Caption
Creator
DisplayHorizontalScrollBar
DisplayLeftScrollBar
DisplayRightRuler
DisplayRulers
DisplayScreenTips
DisplayVerticalRuler
DisplayVerticalScrollBar
Document
DocumentMap
EnvelopeVisible
Height
HorizontalPercentScrolled
Hwnd
IMEMode
Index
Left
Next
Panes
Parent
Previous
Selection
ShowSourceDocuments
Split
SplitVertical
StyleAreaWidth
Thumbnails
Top
Type
UsableHeight
UsableWidth
VerticalPercentScrolled
View
Visible
Width
WindowNumber
WindowState

請參閱

Word 物件模型參考資料

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應