Class Application (Word VBA)

The class Application represents the Microsoft Word application. The Application object includes properties and methods that return top-level objects. For example, the ActiveDocument property returns a Document object.

To use a Application class variable it first needs to be instantiated, for example

Dim app as Application
Set app = Application.KeyBindings

Methods

Activate - Activates the specified object.

AddAddress - Adds an entry to the address book. Each entry has values for one or more tag IDs.

AutomaticChange - Performs an AutoFormat action when there is a change suggested by the Office Assistant. If no AutoFormat action is active, this method generates an error.

BuildKeyCode - Returns a unique number for the specified key combination.

CentimetersToPoints - Converts a measurement from centimeters to points (1 cm = 28.35 points). Returns the converted measurement as a Single.

ChangeFileOpenDirectory - Sets the folder in which Word searches for documents.

CheckGrammar - Checks a string for grammatical errors. Returns a Boolean to indicate whether the string contains grammatical errors. True if the string contains no errors.

CheckSpelling - Checks a string for spelling errors. Returns a Boolean to indicate whether the string contains spelling errors. True if the string has no spelling errors.

CleanString - Removes nonprinting characters (character codes 1–29) and special Word characters from the specified string or changes them to spaces (character code 32). Returns the result as a String.

CompareDocuments - Compares two documents and returns a Document object that represents the document that contains the differences between the two documents, marked using tracked changes.

DDEExecute - Sends a command or series of commands to an application through the specified dynamic data exchange (DDE) channel.

DDEInitiate - Opens a dynamic data exchange (DDE) channel to another application, and returns the channel number.

DDEPoke - Uses an open dynamic data exchange (DDE) channel to send data to an application.

DDERequest - Uses an open dynamic data exchange (DDE) channel to request information from the receiving application, and returns the information as a String.

DDETerminate - Closes the specified dynamic data exchange (DDE) channel to another application.

DDETerminateAll - Closes all dynamic data exchange (DDE) channels opened by Microsoft Word.

DefaultWebOptions - Returns the DefaultWebOptions object that contains global application-level attributes used by Microsoft Word whenever you save a document as a webpage or open a webpage.

GetAddress - Returns an address from the default address book.

GetDefaultTheme - Returns a String that represents the name of the default theme plus the theme formatting options Microsoft Word uses for new documents, email messages, or Web pages.

GetSpellingSuggestions - Returns a SpellingSuggestions collection that represents the words suggested as spelling replacements for a given word.

GoBack - Moves the insertion point among the last three locations where editing occurred in the active document (the same as pressing SHIFT+F5).

GoForward - Moves the insertion point forward among the last three locations where editing occurred in the active document.

Help - Displays installed Help information.

HelpTool -

InchesToPoints - Converts a measurement from inches to points (1 inch = 72 points). Returns the converted measurement as a Single.

Keyboard - Returns or sets the keyboard language and layout settings.

KeyboardBidi - Sets the keyboard language to a right-to-left language and the text entry direction to right-to-left.

KeyboardLatin - Sets the keyboard language to a left-to-right language and the text entry direction to left-to-right.

KeyString - Returns the key combination string for the specified keys (for example, CTRL+SHIFT+A).

LinesToPoints - Converts a measurement from lines to points (1 line = 12 points). Returns the converted measurement as a Single.

ListCommands - Creates a new document and then inserts a table of Word commands along with their associated shortcut keys and menu assignments.

LoadMasterList - Loads a bibliography source file.

LookupNameProperties - Looks up a name in the global address book list and displays the Properties dialog box, which includes information about the specified name.

MergeDocuments - Compares two documents and returns a Document object that represents the document that contains the differences between the two documents, marked using tracked changes.

MillimetersToPoints - Converts a measurement from millimeters to points (1 mm = 2.85 points). Returns the converted measurement as a Single.

Move - Positions a task window or the active document window.

NewWindow - Opens a new window with the same document as the specified window. Returns a Window object.

OnTime - Starts a background timer that runs a macro at a specified time.

OrganizerCopy - Copies the specified AutoText entry, toolbar, style, or macro project item from the source document or template to the destination document or template.

OrganizerDelete - Deletes the specified style, AutoText entry, toolbar, or macro project item from a document or template.

OrganizerRename - Renames the specified style, AutoText entry, toolbar, or macro project item in a document or template.

PicasToPoints - Converts a measurement from picas to points (1 pica = 12 points). Returns the converted measurement as a Single.

PixelsToPoints - Converts a measurement from pixels to points. Returns the converted measurement as a Single.

PointsToCentimeters - Converts a measurement from points to centimeters (1 centimeter = 28.35 points). Returns the converted measurement as a Single.

PointsToInches - Converts a measurement from points to inches (1 inch = 72 points). Returns the converted measurement as a Single.

PointsToLines - Converts a measurement from points to lines (1 line = 12 points). Returns the converted measurement as a Single.

PointsToMillimeters - Converts a measurement from points to millimeters (1 millimeter = 2.835 points). Returns the converted measurement as a Single.

PointsToPicas - Converts a measurement from points to picas (1 pica = 12 points). Returns the converted measurement as a Single.

PointsToPixels - Converts a measurement from points to pixels. Returns the converted measurement as a Single.

PrintOut - Prints all or part of the specified document.

ProductCode - Returns the Microsoft Word globally unique identifier (GUID) as a String.

PutFocusInMailHeader - Places the insertion point in the Toline of the mail header if the document in the active window is an email document.

Quit - Quits Microsoft Word and optionally saves or routes the open documents.

Repeat - Repeats the most recent editing action one or more times. Returns True if the commands were repeated successfully.

ResetIgnoreAll - Clears the list of words that were previously ignored during a spelling check.

Resize - Sizes the Word application window or the specified task window.

Run - Runs a Visual Basic macro.

ScreenRefresh - Updates the display on the monitor with the current information in the video memory buffer.

SetDefaultTheme - Sets a default theme for Word to use with new documents, email messages, or webpages.

ShowClipboard - Displays the Clipboard task pane.

ShowMe -

SubstituteFont - Sets font-mapping options.

ToggleKeyboard - Switches the keyboard language setting between right-to-left and left-to-right languages.

Properties

Name (Default member) - Returns the name of the specified object.

ActiveDocument returns a Document object that represents the active document (the document with the focus). If there are no documents open, an error occurs.

ActiveEncryptionSession returns a Long that represents the encryption session associated with the active document.

ActivePrinter returns or sets the name of the active printer.

ActiveProtectedViewWindow returns a ProtectedViewWindow object that represents the active Protected View window.

ActiveWindow returns a Window object that represents the active window (the window with the focus). If there are no windows open, an error occurs.

AddIns returns an AddIns collection that represents all available add-ins, regardless of whether they're currently loaded.

ArbitraryXMLSupportAvailable returns a Boolean that represents whether Microsoft Word accepts custom XML schemas. True indicates that Word accepts custom XML schemas.

Assistance returns an Assistance object that represents the Microsoft Office Help Viewer.

AutoCaptions returns an AutoCaptions collection that represents the captions that are automatically added when items such as tables and pictures are inserted into a document.

AutoCorrect returns an AutoCorrect object that contains the current AutoCorrect options, entries, and exceptions.

AutoCorrectEmail returns an AutoCorrect object that represents automatic corrections made to email messages.

AutomationSecurity returns or sets an MsoAutomationSecurity constant that represents the security setting Microsoft Word uses when programmatically opening files.

BackgroundPrintingStatus returns the number of print jobs in the background printing queue.

BackgroundSavingStatus returns the number of files queued up to be saved in the background.

Bibliography returns a Bibliography object that represents the bibliography references sources stored in Microsoft Word.

BrowseExtraFileTypes set this property to "text/html" to allow hyperlinked HTML files to be opened in Microsoft Word (instead of the default Internet browser).

Browser returns a Browser object that represents the Select Browse Object tool on the vertical scroll bar.

Build returns the version and build number of the Word application.

CapsLock true if the CAPS LOCK key is turned on.

Caption returns or sets the text displayed in the Title bar of the application window.

CaptionLabels returns a CaptionLabels collection that represents all the available caption labels.

ChartDataPointTrack returns or sets a Boolean that specifies whether charts use cell-reference data-point tracking.

CheckLanguage true if Microsoft Word automatically detects the language you are using as you type.

COMAddIns returns a reference to the COMAddIns collection that represents all the Component Object Model (COM) add-ins currently loaded in Microsoft Word.

CommandBars returns a CommandBars collection that represents the menu bar and all the toolbars in Microsoft Word.

CustomDictionaries returns a Dictionaries object that represents the collection of active custom dictionaries.

CustomizationContext returns or sets a Template or Document template that represents the template or document in which changes to menu bars, toolbars, and key bindings are stored. Read/write.

DefaultLegalBlackline true for Microsoft Word to compare and merge documents using the Legal blackline option in the Compare and Merge Documents dialog box.

DefaultSaveFormat returns or sets the default format that will appear in the Save as type box in the Save As dialog box.

DefaultTableSeparator returns or sets the single character used to separate text into cells when text is converted to a table.

Dialogs returns a Dialogs collection that represents all the built-in dialog boxes in Word.

DisplayAlerts returns or sets the way certain alerts and messages are handled while a macro is running.

DisplayAutoCompleteTips true if Word displays tips that suggest text for completing words, dates, or phrases as you type.

DisplayDocumentInformationPanel returns or sets a Boolean that represents whether the document properties panel is displayed.

DisplayRecentFiles true if the names of recently used files are displayed on the File menu.

DisplayScreenTips true if comments, footnotes, endnotes, and hyperlinks are displayed as tips. Text marked as having comments is highlighted.

DisplayScrollBars true if Word displays a scroll bar in at least one document window. False if there are no scroll bars displayed in any window.

Documents returns a Documents collection that represents all the open documents.

DontResetInsertionPointProperties returns or sets a Boolean that represents whether Microsoft Word maintains the formatting properties of the text at that position of the Insertion Point after running other code.

EmailOptions returns an EmailOptions object that represents the global preferences for email authoring.

EmailTemplate returns or sets a String that represents the document template to use when sending email messages.

EnableCancelKey returns or sets the way that Word handles CTRL+BREAK user interruptions.

FeatureInstall returns or sets how Microsoft Word handles calls to methods and properties that require features not yet installed.

FileConverters returns a FileConverters collection that represents all the file converters available to Microsoft Word.

FileDialog returns a FileDialog object which represents a single instance of a file dialog box.

FileValidation returns or sets how Word will validate files before opening them.

FindKey returns a KeyBinding object that represents the specified key combination.

FocusInMailHeader true if the insertion point is in an email header field (the To: field, for example).

FontNames returns a FontNames object that includes the names of all the available fonts.

HangulHanjaDictionaries returns a HangulHanjaConversionDictionaries collection that represents all the active custom conversion dictionaries.

Height returns or sets the height of the active document window in pixels.

International returns information about the current country/region and international settings.

IsObjectValid true if the specified variable that references an object is valid.

IsSandboxed true if the application window is a Protected View window.

KeyBindings returns a KeyBindings collection that represents customized key assignments, which include a key code, a key category, and a command.

KeysBoundTo returns a KeysBoundTo object that represents all the key combinations assigned to the specified item.

LandscapeFontNames returns a FontNames object that includes the names of all the available landscape fonts.

Language returns an MsoLanguageID constant that represents the language selected for the Microsoft Word user interface.

Languages returns a Languages collection that represents the proofing languages listed in the Language dialog box.

LanguageSettings returns a LanguageSettings object, which contains information about the language settings in Microsoft Word.

Left returns or sets a Long that represents the horizontal position of the active document, measured in points.

ListGalleries returns a ListGalleries collection that represents the three list template galleries.

MacroContainer returns a Template or Document template that represents the template or document in which the module that contains the running procedure is stored.

MailingLabel returns a MailingLabel object that represents a mailing label.

MailMessage returns a MailMessage object that represents the active email message.

MailSystem returns the mail system (or systems) installed on the host computer.

MAPIAvailable true if MAPI is installed.

MathCoprocessorAvailable true if a math coprocessor is installed and available to Microsoft Word.

MouseAvailable true if there is a mouse available for the system.

NewDocument

NormalTemplate returns a Template object that represents the Normal template.

NumLock returns the state of the NUM LOCK key. True if the keys on the numeric keypad insert numbers, False if the keys move the insertion point.

OMathAutoCorrect returns an OMathAutoCorrect object that represents the auto correct entries for equations.

OpenAttachmentsInFullScreen returns or sets a Boolean that represents whether Microsoft Word opens email attachments in Reading mode.

Options returns an Options object that represents application settings in Microsoft Word.

Path returns the disk or Web path to the specified object.

PathSeparator returns the character used to separate folder names. This property returns a backslash ().

PickerDialog returns a PickerDialog object that provides the functionality to select people or data in a dialog box.

PortraitFontNames returns a FontNames object that includes the names of all the available portrait fonts.

PrintPreview true if print preview is the current view.

ProtectedViewWindows returns a ProtectedViewWindows collection that represents all Protected View windows.

RecentFiles returns a RecentFiles collection that represents the most recently accessed files.

RestrictLinkedStyles returns or sets a Boolean that represents whether Microsoft Word allows linked styles.

ScreenUpdating true if screen updating is turned on.

Selection returns the Selection object that represents a selected range or the insertion point.

SensitivityLabelPolicy

ShowAnimation this object or member is deprecated and is not intended to be used in your code.

ShowStartupDialog true to display the Task Pane when starting Microsoft Word.

ShowStylePreviews returns or sets a Boolean that represents whether Microsoft Word shows a preview of the formatting for styles in the Styles dialog box.

ShowVisualBasicEditor true if the Visual Basic Editor window is visible.

SmartArtColors returns a SmartArtColors object that represents the set of color styles that are currently loaded in the application.

SmartArtLayouts returns a SmartArtLayouts object that represents the set of SmartArt layouts that are currently loaded in the application.

SmartArtQuickStyles returns a SmartArtQuickStyles object that represents the set of SmartArt styles that are currently loaded in the application.

SpecialMode true if Microsoft Word is in a special mode (for example, CopyText mode, or MoveText mode).

StartupPath returns or sets the complete path of the startup folder, excluding the final separator.

StatusBar this property is no longer supported in Microsoft Word Visual Basic for Applications.

SynonymInfo returns a SynonymInfo object that contains information from the thesaurus on synonyms, antonyms, or related words and expressions for the specified word or phrase.

System returns a System object, which can be used to return system-related information and perform system-related tasks.

TaskPanes returns a TaskPanes collection that represents the most commonly performed tasks in Microsoft Word.

Tasks returns a Tasks collection that represents all the applications that are running.

Templates returns a Templates collection that represents all the available templates—global templates and those attached to open documents.

Top returns or sets the vertical position of the active document.

UndoRecord returns an UndoRecord object that provides a custom entry point into the undo stack.

UsableHeight returns the maximum height (in points) to which you can set the height of a Microsoft Word document window.

UsableWidth returns the maximum width (in points) to which you can set the width of a Microsoft Word document window.

UserAddress returns or sets the user's mailing address.

UserControl true if the document or application was created or opened by the user.

UserInitials returns or sets the user's initials, which Microsoft Word uses to construct comment marks.

UserName returns or sets the user's name, which is used on envelopes and for the Author document property.

VBE returns a VBE object that represents the Visual Basic Editor.

Version returns the Microsoft Word version number.

Visible true if the specified object is visible.

Width returns or sets the width of the application window, in points.

Windows returns a Windows collection that represents all document windows.

WindowState returns or sets the state of the specified document window or task window.

XMLNamespaces returns an collection that represents the XML schemas in the Schema Library.

AddIns - A collection of AddIn objects that represents all the add-ins available to Word, regardless of whether or not they are currently loaded. The AddIns collection includes global templates or Word add-in libraries (WLLs) displayed in the Templates and Add-ins dialog box.

AutoCaptions - A collection of AutoCaption objects that represent the captions that can be automatically added when items such as tables, pictures, or OLE objects are inserted into a document.

AutoCorrect - Represents the AutoCorrect functionality in Word.

Bibliography - Represents the list of sources available attached to the document (in the current list) or the list of sources available in the application (in the master list).

Browser - Represents the browser tool used to move the insertion point to objects in a document. This tool is composed of the three buttons at the bottom of the vertical scroll bar.

CaptionLabels - A collection of CaptionLabel objects that represent the available caption labels. The items in the CaptionLabels collection are listed in the Label box in the Caption dialog box.

DefaultWebOptions - Contains global application-level attributes used by Microsoft Word when you open a webpage or save a document as a webpage.

Dialogs - A collection of Dialog objects in Word. Each Dialog object represents a built-in Word dialog box.

Dictionaries - A collection of Dictionary objects that includes the active custom spelling dictionaries.

Document - Represents a document. The Document object is a member of the Documents collection. The Documents collection contains all the Document objects that are currently open in Word.

Documents - A collection of all the Document objects that are currently open in Word.

EmailOptions - Contains global application-level attributes used by Microsoft Word when you create and edit email messages and replies.

FileConverters - A collection of FileConverter objects that represent all the file converters available for opening and saving files.

FontNames - Represents a list of the names of all the available fonts.

HangulHanjaConversionDictionaries - A collection of Dictionary objects that includes the active custom Hangul-Hanja conversion dictionaries.

KeyBinding - Represents a custom key assignment in the current context. The KeyBinding object is a member of the KeyBindings collection.

KeyBindings - A collection of KeyBinding objects that represent the custom key assignments in the current context. Custom key assignments are made in the Customize Keyboard dialog box.

KeysBoundTo - A collection of KeyBinding objects assigned to a command, style, macro, or other item in the current context.

Languages - A collection of Language objects that represent languages used for proofing or formatting in Word.

ListGalleries - A collection of ListGallery objects that represent the three tabs in the Bullets and Numbering dialog box.

MailingLabel - Represents a mailing label.

MailMessage - Represents the active email message if you are using Microsoft Word as your email editor.

OMathAutoCorrect - Represents the math AutoCorrect feature in Microsoft Word. To access the math AutoCorrect entries, use the OMathAutoCorrectEntries collection.

Options - Represents application and document options in Word. Many of the properties for the Options object correspond to items in the Options dialog box.

ProtectedViewWindow - Represents a Protected View window.

ProtectedViewWindows - A collection of all the ProtectedViewWindow objects that are currently open in Word.

RecentFiles - A collection of RecentFile objects that represents the files that have been used recently. The items in the RecentFiles collection are displayed at the bottom of the File menu.

Selection - Represents the current selection in a window or pane. A selection represents either a selected (or highlighted) area in the document, or it represents the insertion point if nothing in the document is selected. There can be only one Selection object per document window pane, and only one Selection object in the entire application can be active.

SpellingSuggestions - A collection of SpellingSuggestion objects that represent all the suggestions for a specified word or for the first word in the specified range.

SynonymInfo - Represents the information about synonyms, antonyms, related words, or related expressions for the specified range or a given string.

System - Contains information about the computer system.

TaskPanes - A collection of TaskPane objects that contains commonly performed tasks in Microsoft Word.

Tasks - A collection of Task objects that represents all the tasks currently running on the system.

Template - Represents a document template. The Template object is a member of the Templates collection. The Templates collection includes all the available Template objects.

Templates - A collection of Template objects that represent all the templates that are currently available. This collection includes open templates, templates attached to open documents, and global templates loaded in the Templates and Add-ins dialog box.

UndoRecord - Provides an entry point into the undo stack.

Window - Represents a window. Many document characteristics, such as scroll bars and rulers, are actually properties of the window.

Windows - A collection of Window objects that represent all the available windows. The Windows collection for the Application object contains all the windows in the application, whereas the Windows collection for the Document object contains only the windows that display the specified document.

XMLNamespaces -