Word () 的應用程式物件
代表 Microsoft Word 應用程式。 Application 物件包含會傳回最上層物件的屬性和方法。 例如, ActiveDocument 屬性會 傳回 Document 物件。
註解
使用應用程式屬性來傳回應用程式物件。 下列範例會顯示 Word 的使用者名稱。
MsgBox Application.UserName
許多傳回最常見使用者介面物件的屬性和方法,例如使用中檔 (ActiveDocument 屬性) ,都可以在沒有 Application 物件辨識符號的情況下使用。 例如,您可以撰寫 ,而不是撰寫 Application.ActiveDocument.PrintOut
ActiveDocument.PrintOut
。 不需要 Application 物件辨 識符號即可使用的屬性和方法會被視為「全域」。若要在 物件瀏覽器中檢視全域屬性和方法,請按一下 <globals>
[ 類別 ] 方塊中的清單頂端。 (另請參閱 Global object.)
註解
若要使用 Automation (之前稱為 OLE Automation) 來從另一個應用程式控制 Word,請使用 Microsoft Visual Basic 的 CreateObject 或 GetObject 函數來傳回 Word Application 物件。 下列 Microsoft Excel 範例會啟動 Word (如果目前尚未執行),並開啟現有的文件。
Set wrd = GetObject(, "Word.Application")
wrd.Visible = True
wrd.Documents.Open "C:\My Documents\Temp.doc"
Set wrd = Nothing
事件
- DocumentBeforeClose
- DocumentBeforePrint
- DocumentBeforeSave
- DocumentChange
- DocumentOpen
- DocumentSync
- EPostageInsert
- EPostageInsertEx
- EPostagePropertyDialog
- MailMergeAfterMerge
- MailMergeAfterRecordMerge
- MailMergeBeforeMerge
- MailMergeBeforeRecordMerge
- MailMergeDataSourceLoad
- MailMergeDataSourceValidate
- MailMergeDataSourceValidate2
- MailMergeWizardSendToCustom
- MailMergeWizardStateChange
- NewDocument
- ProtectedViewWindowActivate
- ProtectedViewWindowBeforeClose
- ProtectedViewWindowBeforeEdit
- ProtectedViewWindowDeactivate
- ProtectedViewWindowOpen
- ProtectedViewWindowSize
- Quit
- WindowActivate
- WindowBeforeDoubleClick
- WindowBeforeRightClick
- WindowDeactivate
- WindowSelectionChange
- WindowSize
- XMLSelectionChange
- XMLValidationError
方法
- Activate
- AddAddress
- AutomaticChange
- BuildKeyCode
- CentimetersToPoints
- ChangeFileOpenDirectory
- CheckGrammar
- CheckSpelling
- CleanString
- CompareDocuments
- DDEExecute
- DDEInitiate
- DDEPoke
- DDERequest
- DDETerminate
- DDETerminateAll
- DefaultWebOptions
- GetAddress
- GetDefaultTheme
- GetSpellingSuggestions
- GoBack
- GoForward
- Help
- HelpTool
- InchesToPoints
- Keyboard
- KeyboardBidi
- KeyboardLatin
- KeyString
- LinesToPoints
- ListCommands
- LoadMasterList
- LookupNameProperties
- MergeDocuments
- MillimetersToPoints
- Move
- NewWindow
- NextLetter
- OnTime
- OrganizerCopy
- OrganizerDelete
- OrganizerRename
- PicasToPoints
- PixelsToPoints
- PointsToCentimeters
- PointsToInches
- PointsToLines
- PointsToMillimeters
- PointsToPicas
- PointsToPixels
- PrintOut
- ProductCode
- PutFocusInMailHeader
- Quit
- Repeat
- ResetIgnoreAll
- Resize
- Run
- ScreenRefresh
- SetDefaultTheme
- ShowClipboard
- ShowMe
- SubstituteFont
- ToggleKeyboard
屬性
- ActiveDocument
- ActiveEncryptionSession
- ActivePrinter
- ActiveProtectedViewWindow
- ActiveWindow
- AddIns
- Application
- ArbitraryXMLSupportAvailable
- Assistance
- AutoCaptions
- AutoCorrect
- AutoCorrectEmail
- AutomationSecurity
- BackgroundPrintingStatus
- BackgroundSavingStatus
- Bibliography
- BrowseExtraFileTypes
- Browser
- Build
- CapsLock
- Caption
- CaptionLabels
- ChartDataPointTrack
- CheckLanguage
- COMAddIns
- CommandBars
- Creator
- CustomDictionaries
- CustomizationContext
- DefaultLegalBlackline
- DefaultSaveFormat
- DefaultTableSeparator
- Dialogs
- DisplayAlerts
- DisplayAutoCompleteTips
- DisplayDocumentInformationPanel
- DisplayRecentFiles
- DisplayScreenTips
- DisplayScrollBars
- Documents
- DontResetInsertionPointProperties
- EmailOptions
- EmailTemplate
- EnableCancelKey
- FeatureInstall
- FileConverters
- FileDialog
- FileValidation
- FindKey
- FocusInMailHeader
- FontNames
- HangulHanjaDictionaries
- Height
- International
- IsObjectValid
- IsSandboxed
- KeyBindings
- KeysBoundTo
- LandscapeFontNames
- Language
- Languages
- LanguageSettings
- Left
- ListGalleries
- MacroContainer
- MailingLabel
- MailMessage
- MailSystem
- MAPIAvailable
- MathCoprocessorAvailable
- MouseAvailable
- Name
- NewDocument
- NormalTemplate
- NumLock
- OMathAutoCorrect
- OpenAttachmentsInFullScreen
- Options
- Parent
- Path
- PathSeparator
- PickerDialog
- PortraitFontNames
- PrintPreview
- ProtectedViewWindows
- RecentFiles
- RestrictLinkedStyles
- ScreenUpdating
- Selection
- SensitivityLabelPolicy
- ShowAnimation
- ShowStartupDialog
- ShowStylePreviews
- ShowVisualBasicEditor
- SmartArtColors
- SmartArtLayouts
- SmartArtQuickStyles
- SpecialMode
- StartupPath
- StatusBar
- SynonymInfo
- System
- TaskPanes
- Tasks
- Templates
- Top
- UndoRecord
- UsableHeight
- UsableWidth
- UserAddress
- UserControl
- UserInitials
- UserName
- VBE
- Version
- Visible
- Width
- Windows
- WindowState
- WordBasic
- XMLNamespaces
請參閱
支援和意見反應
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。