Class Application (Excel VBA)

The class Application represents the entire Microsoft Excel application.

Themes

Some procedures in this class have been grouped together in themes and are described on separate theme pages

Cell with its procedures ActiveCell, CellDragAndDrop, Cells, EditDirectlyInCell, LargeOperationCellThousandCount and ThisCell
Print with its procedures ActivePrinter and PrintCommunication
DDE with its procedures DDEAppReturnCode, DDEExecute, DDEInitiate, DDEPoke, DDERequest and DDETerminate
Display/Show with its procedures DisplayAlerts, DisplayClipboardWindow, DisplayCommentIndicator, DisplayDocumentActionTaskPane, DisplayFormulaAutoComplete, DisplayFormulaBar, DisplayFullScreen, DisplayFunctionToolTips, DisplayInsertOptions, DisplayNoteIndicator, DisplayPasteOptions, DisplayRecentFiles, DisplayScrollBars, DisplayStatusBar, ShowChartTipNames, ShowDevTools, ShowMenuFloaties, ShowQuickAnalysis, ShowSelectionFloaties, ShowStartupDialog and ShowToolTips
Enable with its procedures EnableAutoComplete, EnableCancelKey, EnableCheckFileExtensions, EnableEvents, EnableLargeOperationAlert, EnableLivePreview, EnableMacroAnimations and EnableSound
Name with its procedures GetOpenFilename, GetSaveAsFilename, OrganizationName, UserName and WarnOnFunctionNameConflict
Email with its procedures MailLogoff, MailLogon, MailSession and MailSystem
ODBC with its procedures ODBCErrors and ODBCTimeout
Value with its procedures ShowChartTipValues and Value

Methods

Other Methods

AddCustomList - Adds a custom list for custom autofill and/or custom sort.

On Error Resume Next  ' if the list already exists, do nothing
Application.AddCustomList Array("cogs", "sprockets", _ 
 "widgets", "gizmos")
On Error Goto 0       ' resume regular error handling

CheckSpelling - Checks the spelling of a single word.

ConvertFormula - Converts cell references in a formula between the A1 and R1C1 reference styles, between relative and absolute references, or both.

inputFormula = "=SUM(R10C2:R15C2)" 
MsgBox Application.ConvertFormula( _ 
 formula:=inputFormula, _ 
 fromReferenceStyle:=xlR1C1, _ 
 toReferenceStyle:=xlA1)

Goto - Selects any range or Visual Basic procedure in any workbook, and activates that workbook if it's not already active.

Application.Goto Reference:=Worksheets("Sheet1").Range("A154"), _ 
 scroll:=True

Help - Displays a Help topic.

InputBox - Displays a dialog box for user input. Returns the information entered in the dialog box.

Set myRange = Application.InputBox(prompt := "Sample", type := 8)

Intersect - Returns a Range object that represents the rectangular intersection of two or more ranges. If one or more ranges from a different worksheet are specified, an error is returned.

Worksheets("Sheet1").Activate 
Set isect = Application.Intersect(Range("rg1"), Range("rg2")) 
If isect Is Nothing Then 
 MsgBox "Ranges do not intersect" 
Else 
 isect.Select 
End If

MacroOptions - Corresponds to options in the Macro Options dialog box. You can also use this method to display a user-defined function (UDF) in a built-in or new category within the Insert Function dialog box.

Function TestMacro() 
    MsgBox ActiveWorkbook.Name 
End Function 
 
Sub AddUDFToCustomCategory() 
    Application.MacroOptions Macro:="TestMacro", Category:="My Custom Category" 
End Sub

OnKey - Runs a specified procedure when a particular key or key combination is pressed.

Application.OnKey "^{+}", "InsertProc" 
Application.OnKey "+^{RIGHT}", "SpecialPrintProc"

OnRepeat - Sets the Repeat item and the name of the procedure that will run if you choose the Repeat command after running the procedure that sets this property.

Application.OnRepeat "Repeat VB Procedure", _ 
 "Book1.xls!My_Repeat_Sub" 
Application.OnUndo "Undo VB Procedure", _ 
 "Book1.xls!My_Undo_Sub"

OnTime - Schedules a procedure to be run at a specified time in the future (either at a specific time of day or after a specific amount of time has passed).

Application.OnTime Now + TimeValue("00:00:15"), "my_Procedure"

OnUndo - Sets the text of the Undo command and the name of the procedure that's run if you choose the Undo command after running the procedure that sets this property.

Application.OnRepeat "Repeat VB Procedure", _ 
 "Book1.xls!My_Repeat_Sub" 
Application.OnUndo "Undo VB Procedure", _ 
 "Book1.xls!My_Undo_Sub"

RecordMacro - Records code if the macro recorder is on.

Application.RecordMacro BasicCode:="Application.Run ""MySub"" "

Run - Runs a macro or calls a function. This can be used to run a macro written in Visual Basic or the Microsoft Excel macro language, or to run a function in a DLL or XLL.

SendKeys - Sends keystrokes to the active application.

Application.SendKeys("%fx")

Union - Returns the union of two or more ranges.

Worksheets("Sheet1").Activate 
Set bigRange = Application.Union(Range("Range1"), Range("Range2")) 
bigRange.Formula = "=RAND()"

Properties

ActiveChart returns a Chart object that represents the active chart (either an embedded chart or a chart sheet). An embedded chart is considered active when it's either selected or activated. When no chart is active, this property returns Nothing.

ActiveChart.HasLegend = True

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

ActiveProtectedViewWindow returns a ProtectedViewWindow object that represents the active Protected View window (the window on top). Returns Nothing if there are no Protected View windows open.

MsgBox "The name of the active Protected View window is " & ActiveProtectedWindow.Caption

ActiveSheet returns an object that represents the active sheet (the sheet on top) in the active workbook or in the specified window or workbook. Returns Nothing if no sheet is active.

MsgBox "The name of the active sheet is " & ActiveSheet.Name

ActiveWindow returns a Window object that represents the active Excel window (the window on top). Returns Nothing if there are no windows open.

MsgBox "The name of the active window is " & ActiveWindow.Caption

ActiveWorkbook returns a Workbook object that represents the workbook in the active window (the window on top). Returns Nothing if there are no windows open or if either the Info window or the Clipboard window is the active window.

MsgBox "The name of the active workbook is " & ActiveWorkbook.Name

AddIns returns an AddIns collection that represents all the add-ins listed in the Add-Ins dialog box (Add-Ins command on the Developer tab).

If AddIns("Analysis ToolPak").Installed = True Then 
 MsgBox "Analysis ToolPak add-in is installed" 
Else 
 MsgBox "Analysis ToolPak add-in is not installed" 
End If

AddIns2 returns an AddIns2 collection that represents all the add-ins that are currently available or open in Microsoft Excel, regardless of whether they are installed.

If Application.AddIns2("Analysis ToolPak").Installed = True Then 
 MsgBox "Analysis ToolPak add-in is installed" 
Else 
 MsgBox "Analysis ToolPak add-in is not installed" 
End If

AlertBeforeOverwriting true if Microsoft Excel displays a message before overwriting nonblank cells during a drag-and-drop editing operation.

Application.AlertBeforeOverwriting = True

AltStartupPath returns or sets the name of the alternate startup folder.

Application.AltStartupPath = "C:\EXCEL\MACROS"

AlwaysUseClearType returns or sets a Boolean that represents whether to use ClearType to display fonts in the menu, ribbon, and dialog box text.

ArbitraryXMLSupportAvailable returns a Boolean value that indicates whether the XML features in Microsoft Excel are available.

AskToUpdateLinks true if Microsoft Excel asks the user to update links when opening files with links. False if links are automatically updated with no dialog box.

Application.AskToUpdateLinks = True

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

AutoCorrect returns an AutoCorrect object that represents the Microsoft Excel AutoCorrect attributes.

With Application.AutoCorrect 
 .AddReplacement "Temperature", "Temp." 
End With

AutoFormatAsYouTypeReplaceHyperlinks true (default) if Microsoft Excel automatically formats hyperlinks as you type. False if Excel does not automatically format hyperlinks as you type.

Sub CheckHyperlinks() 
 
 ' Determine if automatic formatting is enabled and notify user. 
 If Application.AutoFormatAsYouTypeReplaceHyperlinks = True Then 
 MsgBox "Automatic formatting for typing in hyperlinks is enabled." 
 Else 
 MsgBox "Automatic formatting for typing in hyperlinks is not enabled." 
 End If 
 
End Sub

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

Sub Security() 
    Dim secAutomation As MsoAutomationSecurity 
 
    secAutomation = Application.AutomationSecurity 
 
    Application.AutomationSecurity = msoAutomationSecurityForceDisable 
    Application.FileDialog(msoFileDialogOpen).Show 
 
    Application.AutomationSecurity = secAutomation 
 
End Sub

AutoPercentEntry true if entries in cells formatted as percentages aren't automatically multiplied by 100 as soon as they are entered.

Application.AutoPercentEntry = False

AutoRecover returns an AutoRecover object, which backs up all file formats on a timed interval.

Sub UseAutoRecover() 
 
 Application.AutoRecover.Time = 5 
 
 MsgBox "The time that will elapse between each automatic " & _ 
 "save has been set to " & _ 
 Application.AutoRecover.Time & " minutes." 
 
End Sub

Build returns the Microsoft Excel build number.

If Application.Build > 2500 Then 
 ' build-dependent code here 
End If

CalculateBeforeSave true if workbooks are calculated before they're saved to disk (if the Calculation property is set to xlManual). This property is preserved even if you change the Calculation property.

Application.Calculation = xlManual 
Application.CalculateBeforeSave = True

Calculation returns or sets an XlCalculation value that represents the calculation mode.

Application.Calculation = xlCalculationManual 
Application.CalculateBeforeSave = True

CalculationInterruptKey sets or returns an XlCalculationInterruptKey constant that specifies the key that can interrupt Microsoft Excel when performing calculations.

Sub CheckInterruptKey() 
 
 ' Determine the calculation interrupt key and notify the user. 
 Select Case Application.CalculationInterruptKey 
 Case xlAnyKey 
 MsgBox "The calculation interrupt key is set to any key." 
 Case xlEscKey 
 MsgBox "The calculation interrupt key is set to 'Escape'" 
 Case xlNoKey 
 MsgBox "The calculation interrupt key is set to no key." 
 End Select 
 
End Sub

CalculationState returns an XlCalculationState constant that indicates the calculation state of the application, for any calculations that are being performed in Microsoft Excel.

Sub StillCalculating() 
 
 If Application.CalculationState = xlDone Then 
 MsgBox "Done" 
 Else 
 MsgBox "Not Done" 
 End If 
 
End Sub

CalculationVersion returns a number whose rightmost four digits are the minor calculation engine version number, and whose other digits (on the left) are the major version of Microsoft Excel.

If Application.CalculationVersion <> _ 
 Workbooks(1).CalculationVersion Then 
 blnFullCalc = True 
Else 
 blnFullCalc = False 
End If

Caller returns information about how Visual Basic was called (for more information, see the Remarks section).

Select Case TypeName(Application.Caller) 
 Case "Range" 
 v = Application.Caller.Address 
 Case "String" 
 v = Application.Caller 
 Case "Error" 
 v = "Error" 
 Case Else 
 v = "unknown" 
End Select 
MsgBox "caller = " & v

CanPlaySounds this property should not be used. Sound notes have been removed from Microsoft Excel.

CanRecordSounds this property should not be used. Sound notes have been removed from Microsoft Excel.

Caption returns or sets a String value that represents the name that appears in the title bar of the main Microsoft Excel window.

Application.Caption = "Blue Sky Airlines Reservation System"

ChartDataPointTrack true causes all charts in newly created documents to use the cell reference tracking behavior.

Charts returns a Sheets collection that represents all the chart sheets in the active workbook.

With Charts("Chart1") 
 .HasTitle = True 
 .ChartTitle.Text = "First Quarter Sales" 
End With

ClipboardFormats returns the formats that are currently on the Clipboard, as an array of numeric values. To determine whether a particular format is on the Clipboard, compare each element in the array with the appropriate constant listed in the Remarks section.

aFmts = Application.ClipboardFormats 
For Each fmt In aFmts 
 If fmt = xlClipboardFormatRTF Then 
 MsgBox "Clipboard contains rich text" 
 End If 
Next

ClusterConnector returns or sets the name of the High Performance Computing (HPC) Cluster Connector that is used to run user-defined functions in XLL add-ins.

Columns returns a Range object that represents all the columns on the active worksheet. If the active document isn't a worksheet, the Columns property fails.

COMAddIns returns the COMAddIns collection for Microsoft Excel, which represents the currently installed COM add-ins.

Set objAI = Application.COMAddIns 
MsgBox "Number of COM add-ins available:" & _ 
    objAI.Count

CommandBars returns a CommandBars object that represents the Microsoft Excel command bars.

For Each bar In Application.CommandBars 
    If Not bar.BuiltIn And Not bar.Visible Then bar.Delete 
Next

ConstrainNumeric true if handwriting recognition is limited to numbers and punctuation only.

If Application.WindowsForPens Then 
 Application.ConstrainNumeric = True 
End If

ControlCharacters true if Microsoft Excel displays control characters for right-to-left languages.

Application.ControlCharacters = True

CopyObjectsWithCells true if objects are cut, copied, extracted, and sorted with cells.

Application.CopyObjectsWithCells = True

Cursor returns or sets the appearance of the mouse pointer in Microsoft Excel.

Sub ChangeCursor() 
 
 Application.Cursor = xlIBeam 
 For x = 1 To 1000 
 For y = 1 to 1000 
 Next y 
 Next x 
 Application.Cursor = xlDefault 
 
End Sub

CursorMovement returns or sets a value that indicates whether a visual cursor or a logical cursor is used. Can be one of the following constants: xlVisualCursor or xlLogicalCursor.

Application.CursorMovement = xlVisualCursor

CustomListCount returns the number of defined custom lists (including built-in lists).

MsgBox "There are currently " & Application.CustomListCount & _ 
 " defined custom lists."

CutCopyMode returns or sets the status of Cut or Copy mode. Can be True, False, or an XLCutCopyMode constant, as shown in the following tables.

Select Case Application.CutCopyMode 
 Case Is = False 
 MsgBox "Not in Cut or Copy mode" 
 Case Is = xlCopy 
 MsgBox "In Copy mode" 
 Case Is = xlCut 
 MsgBox "In Cut mode" 
End Select

DataEntryMode returns or sets Data Entry mode, as shown in the following table. When in Data Entry mode, you can enter data only in the unlocked cells in the currently selected range.

If (Application.DataEntryMode = xlOn) Or _ 
 (Application.DataEntryMode = xlStrict) Then 
 Application.DataEntryMode = xlOff 
End If

DecimalSeparator sets or returns the character used for the decimal separator as a String.

Sub ChangeSystemSeparators() 
 
 Range("A1").Formula = "1,234,567.89" 
 MsgBox "The system separators will now change." 
 
 ' Define separators and apply. 
 Application.DecimalSeparator = "-" 
 Application.ThousandsSeparator = "-" 
 Application.UseSystemSeparators = False 
 
End Sub

DefaultFilePath returns or sets the default path that Microsoft Excel uses when it opens files.

MsgBox "The current default file path is " & _ 
 Application.DefaultFilePath

DefaultPivotTableLayoutOptions

DefaultSaveFormat returns or sets the default format for saving files. For a list of valid constants, see the FileFormat property.

Application.DefaultSaveFormat = xlExcel4Workbook

DefaultSheetDirection returns or sets the default direction in which Microsoft Excel displays new windows and worksheets. Can be one of the following XlReadingOrder constants: xlRTL (right to left) or xlLTR (left to right).

Application.DefaultSheetDirection = xlRTL

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

If Application.DefaultWebOptions.Encoding = msoEncodingWestern Then 
 strDocEncoding = "Western" 
Else 
 strDocEncoding = "Other" 
End If

DeferAsyncQueries gets or sets whether asynchronous queries to OLAP data sources are executed when a worksheet is calculated by VBA code.

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

Application.Dialogs(xlDialogOpen).Show

ErrorCheckingOptions returns an ErrorCheckingOptions object, which represents the error checking options for an application.

Sub CheckTextDate() 
 
 ' Enable Microsoft Excel to identify dates written as text. 
 Application.ErrorCheckingOptions.TextDate = True 
 
 Range("A1").Formula = "'April 23, 00" 
 
End Sub

ExtendList true if Microsoft Excel automatically extends formatting and formulas to new data that is added to a list.

Application.ExtendList = False

FeatureInstall returns or sets a value (constant) that specifies how Microsoft Excel handles calls to methods and properties that require features that aren't yet installed. Can be one of the MsoFeatureInstall constants listed in the following table.

Dim WordApp As New Word.Application, Reply As Integer 
Application.ActivateMicrosoftApp xlMicrosoftWord With WordApp 
    If .FeatureInstall = msoFeatureInstallNone Then 
        Reply = MsgBox("Uninstalled features for this " _ 
            & "application " & vbCrLf _ 
            & "may cause a run-time error when called." & vbCrLf _ 
            & vbCrLf _ 
            & "Would you like to change this setting" & vbCrLf _ 
            & "to automatically install missing features?" _ 
            , 52, "Feature Install Setting") 
        If Reply = 6 Then 
            .FeatureInstall = msoFeatureInstallOnDemand 
        End If 
    End If 
End With

FileConverters returns information about installed file converters. Returns null if there are no converters installed.

installedCvts = Application.FileConverters 
foundMultiplan = False 
If Not IsNull(installedCvts) Then 
 For arrayRow = 1 To UBound(installedCvts, 1) 
 If installedCvts(arrayRow, 1) Like "*Multiplan*" Then 
 foundMultiplan = True 
 Exit For 
 End If 
 Next arrayRow 
End If 
If foundMultiplan = True Then 
 MsgBox "Multiplan converter is installed" 
Else 
 MsgBox "Multiplan converter is not installed" 
End If

FileDialog returns a FileDialog object representing an instance of the file dialog.

Sub UseFileDialogOpen() 
 
    Dim lngCount As Long 
 
    ' Open the file dialog 
    With Application.FileDialog(msoFileDialogOpen) 
        .AllowMultiSelect = True 
        .Show 
 
        ' Display paths of each file selected 
        For lngCount = 1 To .SelectedItems.Count 
            MsgBox .SelectedItems(lngCount) 
        Next lngCount 
 
    End With 
 
End Sub

FileExportConverters returns a FileExportConverters collection that represents all the file converters for saving files available to Microsoft Excel.

Dim fcTemp As FileExportConverter 
Set fcTemp = FileExportConverter(1) 
 
MsgBox fcTemp.Description

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

FileValidationPivot returns or sets how Excel will validate the contents of the data caches for PivotTable reports.

FixedDecimal all data entered after this property is set to True will be formatted with the number of fixed decimal places set by the FixedDecimalPlaces property.

Application.FixedDecimal = True 
Application.FixedDecimalPlaces = 4

FixedDecimalPlaces returns or sets the number of fixed decimal places used when the FixedDecimal property is set to True.

Application.FixedDecimal = True 
Application.FixedDecimalPlaces = 4

FlashFill true indicates that the Excel Flash Fill feature has been enabled and active.

FlashFillMode true if the Flash Fill feature is enabled.

FormulaBarHeight allows the user to specify the height of the formula bar in lines.

Application.FormulaBarHeight = 5 

GenerateGetPivotData returns True when Microsoft Excel can get PivotTable report data.

Sub PivotTableInfo() 
 
 ' Determine the ability to get PivotTable report data and notify user. 
 If Application.GenerateGetPivotData = True Then 
 MsgBox "The ability to get PivotTable report data is enabled." 
 Else 
 Msgbox "The ability to get PivotTable report data is disabled." 
 End If 
 
End Sub

GenerateTableRefs the GenerateTableRefs property determines whether the traditional notation method or the new structured referencing notation method is used for referencing tables in formulas.

Height returns or sets a Double value that represents the height, in points, of the main application window.

HighQualityModeForGraphics returns or sets whether Excel uses high quality mode to print graphics.

Hinstance returns a handle to the instance of Excel represented by the Application object.

Sub CheckHinstance() 
 
 MsgBox Application.Hinstance 
 
End Sub

HinstancePtr returns a handle to the instance of Excel represented by the specified Application object.

Sub CheckHinstance() 
    MsgBox Application.HinstancePtr 
End Sub

Hwnd returns a Long indicating the top-level window handle of the Microsoft Excel window.

Sub CheckHwnd() 
 
 MsgBox "The top-level window handle is: " & _ 
 Application.hWnd 
 
End Sub

IgnoreRemoteRequests true if remote DDE requests are ignored.

Application.IgnoreRemoteRequests = True

Interactive true if Microsoft Excel is in interactive mode; this property is usually True. If you set this property to False, Excel blocks all input from the keyboard and mouse (except input to dialog boxes that are displayed by your code).

Application.Interactive = False 
Application.DisplayAlerts = False 
channelNumber = Application.DDEInitiate( _ 
 app:="WinWord", _ 
 topic:="C:\WINWORD\FORMLETR.DOC") 
Application.DDEExecute channelNumber, "[FILEPRINT]" 
Application.DDETerminate channelNumber 
Application.DisplayAlerts = True 
Application.Interactive = True

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

MsgBox "The decimal separator is " & _ 
 Application.International(xlDecimalSeparator)

IsSandboxed returns True if the specified workbook is open in a Protected View window.

Sub CheckIfSandboxed(wbk As Workbook) 
 MsgBox wbk.Application.IsSandboxed 
End Sub

Iteration true if Microsoft Excel uses iteration to resolve circular references.

Application.Iteration = True

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

Set objLangSet = Application.LanguageSettings 
MsgBox objLangSet.LanguageID(msoLanguageIDInstall)

Left returns or sets a Double value that represents the distance, in points, from the left edge of the screen to the left edge of the main Microsoft Excel window.

LibraryPath returns the path to the Library folder, but without the final separator.

pathSep = Application.PathSeparator 
f = Application.LibraryPath & pathSep & "Oscar.xla" 
Workbooks.Open filename:=f

MapPaperSize true if documents formatted for the standard paper size of another country/region (for example, A4) are automatically adjusted so that they're printed correctly on the standard paper size (for example, Letter) of your country/region.

Sub UseMapPaperSize() 
 
 ' Determine setting and notify user. 
 If Application.MapPaperSize = True Then 
 MsgBox "Microsoft Excel automatically " & _ 
 "adjusts the paper size according to the country/region setting." 
 Else 
 MsgBox "Microsoft Excel does not " & _ 
 "automatically adjusts the paper size according to the country/region setting." 
 End If 
 
End Sub

MathCoprocessorAvailable true if a math coprocessor is available.

If Not Application.MathCoprocessorAvailable Then 
 MsgBox "This macro requires a math coprocessor" 
End If

MaxChange returns or sets the maximum amount of change between each iteration as Microsoft Excel resolves circular references.

Application.MaxChange = 0.1

MaxIterations returns or sets the maximum number of iterations that Microsoft Excel can use to resolve a circular reference.

Application.MaxIterations = 1000

MeasurementUnit specifies the measurement unit used in the application.

Application.MeasurementUnit = xlInches

MergeInstances true to merge multiple instances of the application into a single instance.

Application.MergeInstances = True

MouseAvailable true if a mouse is available.

If Application.MouseAvailable = False Then 
 MsgBox "Your system does not have a mouse" 
End If

MoveAfterReturn true if the active cell is moved as soon as the Enter (Return) key is pressed.

Application.MoveAfterReturn = True

MoveAfterReturnDirection returns or sets the direction in which the active cell is moved when the user presses Enter.

Application.MoveAfterReturn = True 
Application.MoveAfterReturnDirection = xlToRight

MultiThreadedCalculation returns a MultiThreadedCalculation object that controls the multi-threaded recalculation settings.

Name returns a String value that represents the name of the object.

Names returns a Names collection that represents all the names in the active workbook.

NetworkTemplatesPath returns the network path where templates are stored. If the network path doesn't exist, this property returns an empty string.

Msgbox Application.NetworkTemplatesPath

NewWorkbook

OLEDBErrors returns the OLEDBErrors collection, which represents the error information returned by the most recent OLE DB query.

Set objEr = Application.OLEDBErrors.Item(1) 
MsgBox "The following error occurred:" & _ 
 objEr.ErrorString & " : " & objEr.SqlState

OnWindow returns or sets the name of the procedure that's run whenever you activate a window.

OperatingSystem returns the name and version number of the current operating system.

MsgBox "Microsoft Excel is using " & Application.OperatingSystem

Parent returns the parent object for the specified object.

Path returns a String value that represents the complete path to the application, excluding the final separator and name of the application.

Sub TotalPath() 
 
 MsgBox "The path is " & Application.Path 
 
End Sub

PathSeparator returns the path separator character (\).

MsgBox "The path separator character is " & _ 
 Application.PathSeparator

PivotTableSelection true if PivotTable reports use structured selection.

Application.PivotTableSelection = True 
Worksheets(1).PivotTables(1).SelectionMode = xlDataOnly

PreviousSelections returns an array of the last four ranges or names selected. Each element in the array is a Range range. Read-only Variant.

On Error GoTo noSelections 
For i = LBound(Application.PreviousSelections) To _ 
 UBound(Application.PreviousSelections) 
 MsgBox Application.PreviousSelections(i).Address 
Next i 
Exit Sub 
On Error GoTo 0 
 
noSelections: 
 MsgBox "There are no previous selections"

ProductCode returns the globally unique identifier (GUID) for Microsoft Excel.

MsgBox Application.ProductCode

PromptForSummaryInfo true if Microsoft Excel asks for summary information when files are first saved.

Application.PromptForSummaryInfo = True

ProtectedViewWindows returns a ProtectedViewWindows collection that represents all the Protected View windows that are open in the application.

QuickAnalysis returns a QuickAnalysis object that represents the Quick Analysis options of the application.

Sub ShowQuickAnalysisOptions()

'Displays the Quick Analysis contextual UI with the Sparklines option highlighted.
  Application.QuickAnalysis.Show (xlSparklines)

End Sub

Range returns a Range object that represents a cell or a range of cells.

Worksheets("Sheet1").Range("A1").Value = 3.14159

Ready returns True when the Microsoft Excel application is ready; False when the Excel application is not ready.

Sub UseReady() 
 
 If Application.Ready = True Then 
 MsgBox "Application is ready." 
 Else 
 MsgBox "Application is not ready." 
 End If 
 
End Sub

RecentFiles returns a RecentFiles collection that represents the list of recently used files.

Application.RecentFiles.Maximum = 6

RecordRelative true if macros are recorded by using relative references; False if recording is absolute.

Worksheets("Sheet1").Activate 
If Application.RecordRelative = False Then 
 MsgBox ActiveCell.Address(ReferenceStyle:=xlA1) 
Else 
 MsgBox ActiveCell.Address(ReferenceStyle:=xlR1C1) 
End If

ReferenceStyle returns or sets how Microsoft Excel displays cell references and row and column headings in either A1 or R1C1 reference style.

If Application.ReferenceStyle = xlR1C1 Then 
 MsgBox ("Microsoft Excel is using R1C1 references") 
Else 
 MsgBox ("Microsoft Excel is using A1 references") 
End If

RegisteredFunctions returns information about functions in either dynamic-link libraries (DLLs) or code resources that were registered with the REGISTER or REGISTER.ID macro functions.

theArray = Application.RegisteredFunctions 
If IsNull(theArray) Then 
 MsgBox "No registered functions" 
Else 
 For i = LBound(theArray) To UBound(theArray) 
 For j = 1 To 3 
 Worksheets("Sheet1").Cells(i, j). _ 
 Formula = theArray(i, j) 
 Next j 
 Next i 
End If

RollZoom true if the IntelliMouse zooms instead of scrolling.

Application.RollZoom = True

Rows returns a Range object that represents all the rows on the active worksheet. If the active document isn't a worksheet, the Rows property fails.

Worksheets("Sheet1").Rows(3).Delete

RTD returns an RTD object.

ScreenUpdating true if screen updating is turned on.

Dim elapsedTime(2) 
Application.ScreenUpdating = True 
For i = 1 To 2 
 If i = 2 Then Application.ScreenUpdating = False 
 startTime = Time 
 Worksheets("Sheet1").Activate 
 For Each c In ActiveSheet.Columns 
 If c.Column Mod 2 = 0 Then 
 c.Hidden = True 
 End If 
 Next c 
 stopTime = Time 
 elapsedTime(i) = (stopTime - startTime) * 24 * 60 * 60 
Next i 
Application.ScreenUpdating = True 
MsgBox "Elapsed time, screen updating on: " & elapsedTime(1) & _ 
 " sec." & Chr(13) & _ 
 "Elapsed time, screen updating off: " & elapsedTime(2) & _ 
 " sec."

Selection returns the currently selected object on the active worksheet for an Application object. Returns Nothing if no objects are selected. Use the Select method to set the selection, and use the TypeName function to discover the kind of object that is selected.

Worksheets("Sheet1").Activate 
Selection.Clear

Sheets returns a Sheets collection that represents all the sheets in the active workbook.

Set newSheet = Sheets.Add(Type:=xlWorksheet) 
For i = 1 To Sheets.Count 
 newSheet.Cells(i, 1).Value = Sheets(i).Name 
Next i

SheetsInNewWorkbook returns or sets the number of sheets that Microsoft Excel automatically inserts into new workbooks.

MsgBox "Microsoft Excel inserts " & _ 
 Application.SheetsInNewWorkbook & _ 
 " sheet(s) in each new workbook"

ShowConvertToDataType

SmartArtColors returns the set of SmartArtColors styles that are currently loaded in the application.

SmartArtLayouts returns the set of SmartArtLayouts that are currently loaded in the application.

SmartArtQuickStyles returns the set of SmartArtQuickStyles that are currently loaded in the application.

Speech returns a Speech object.

Sub UseSpeech() 
 
 Application.Speech.Speak "Hello" 
 
End Sub

SpellingOptions returns a SpellingOptions object that represents the spelling options of the application.

Sub MixedDigitCheck() 
 
 ' Determine the setting on spell checking for mixed digits. 
 If Application.SpellingOptions.IgnoreMixedDigits = True Then 
 MsgBox "The spelling options are set to ignore mixed digits." 
 Else 
 MsgBox "The spelling options are set to check for mixed digits." 
 End If 
 
End Sub

StandardFont returns or sets the name of the standard font.

If Application.OperatingSystem Like "*Macintosh*" Then 
 Application.StandardFont = "Geneva" 
Else 
 Application.StandardFont = "Arial" 
End If

StandardFontSize returns or sets the standard font size, in points.

Application.StandardFontSize = 12

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

MsgBox Application.StartupPath

StatusBar returns or sets the text in the status bar. Read/write String.

oldStatusBar = Application.DisplayStatusBar 
Application.DisplayStatusBar = True 
Application.StatusBar = "Please be patient..." 
Workbooks.Open filename:="LARGE.XLS" 
Application.StatusBar = False 
Application.DisplayStatusBar = oldStatusBar

TemplatesPath returns the local path where templates are stored.

Msgbox Application.TemplatesPath

ThisWorkbook returns a Workbook object that represents the workbook where the current macro code is running.

ThisWorkbook.Close SaveChanges:=False

ThousandsSeparator sets or returns the character used for the thousands separator as a String.

Sub ChangeSystemSeparators() 
 
 Range("A1").Formula = "1,234,567.89" 
 MsgBox "The system separators will now change." 
 
 ' Define separators and apply. 
 Application.DecimalSeparator = "-" 
 Application.ThousandsSeparator = "-" 
 Application.UseSystemSeparators = False 
 
End Sub

Top returns or sets a Double value that represents the distance, in points, from the top edge of the screen to the top edge of the main Microsoft Excel window.

TransitionMenuKey returns or sets the Microsoft Excel menu or help key, which is usually /.

Application.TransitionMenuKey = "/"

TransitionMenuKeyAction returns or sets the action taken when the Microsoft Excel menu key is pressed. Can be either xlExcelMenus or xlLotusHelp (see the Excel constants enumeration).

Application.TransitionMenuKeyAction = xlLotusHelp 

TransitionNavigKeys true if transition navigation keys are active.

If Application.TransitionNavigKeys Then 
 keyState = "On" 
Else 
 keyState = "Off" 
End If 
MsgBox "The Transition Navigation Keys option is " & keyState

UsableHeight returns the maximum height of the space that a window can occupy in the application window area, in points.

With ActiveWindow 
 .WindowState = xlNormal 
 .Top = 1 
 .Left = 1 
 .Height = Application.UsableHeight 
 .Width = Application.UsableWidth 
End With

UsableWidth returns the maximum width of the space that a window can occupy in the application window area, in points.

With ActiveWindow 
 .WindowState = xlNormal 
 .Top = 1 
 .Left = 1 
 .Height = Application.UsableHeight 
 .Width = Application.UsableWidth 
End With

UseClusterConnector returns or sets whether Excel allows user-defined functions in XLL add-ins to be run on a compute cluster.

UsedObjects returns a UsedObjects object representing objects allocated in a workbook.

Sub CountUsedObjects() 
 
 MsgBox "The number of used objects in this application is: " & _ 
 Application.UsedObjects.Count 
 
End Sub

UserControl true if the application is visible or if it was created or started by the user. False if you created or started the application programmatically by using the CreateObject or GetObject functions, and the application is hidden.

If Application.UserControl Then 
 MsgBox "This workbook was created by the user" 
Else 
 MsgBox "This workbook was created programmatically" 
End If 

UserLibraryPath returns the path to the location on the user's computer where the COM add-ins are installed.

strLibPath = Application.UserLibraryPath

UseSystemSeparators true (default) if the system separators of Microsoft Excel are enabled.

Sub ChangeSystemSeparators() 
 
 Range("A1").Formula = "1,234,567.89" 
 MsgBox "The system separators will now change." 
 
 ' Define separators and apply. 
 Application.DecimalSeparator = "-" 
 Application.ThousandsSeparator = "-" 
 Application.UseSystemSeparators = False 
 
End Sub

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

Application.VBE.ActiveVBProject.Name = "TestProject"

Version returns a String value that represents the Microsoft Excel version number.

MsgBox "Welcome to Microsoft Excel version " & _ 
 Application.Version & " running on " & _ 
 Application.OperatingSystem & "!"

Visible returns or sets a Boolean value that determines whether the object is visible.

'When used in a workbook this makes Excel invisible.
Application.Visible = False

'Waiting  five seconds, then showing Excel again.
Application.Wait Now + TimeValue("00:00:05")

'Makes Excel visible again.
Application.Visible = True

Watches returns a Watches object representing a range that is tracked when the worksheet is recalculated.

Sub AddWatch() 
 With Application 
 .Range("A1").Formula = 1 
 .Range("A2").Formula = 2 
 .Range("A3").Formula = "=Sum(A1:A2)" 
 .Range("A3").Select 
 .Watches.Add Source:=ActiveCell 
 End With 
End Sub

Width returns or sets a Double value that represents the distance, in points, from the left edge of the application window to its right edge.

With ActiveWindow 
 .WindowState = xlNormal 
 .Top = 1 
 .Left = 1 
 .Height = Application.UsableHeight 
 .Width = Application.UsableWidth 
End With

Windows returns a Windows collection that represents all the windows in all the workbooks.

Application.Windows(1).Close

WindowsForPens true if the computer is running under Microsoft Windows for Pen Computing.

If Application.WindowsForPens Then 
 Application.ConstrainNumeric = True 
End If

WindowState returns or sets the state of the window.

Application.WindowState = xlMaximized

Workbooks returns a Workbooks collection that represents all the open workbooks.

Workbooks("BOOK1").Activate

WorksheetFunction returns the WorksheetFunction object.

Set myRange = Worksheets("Sheet1").Range("A1:C10") 
answer = Application.WorksheetFunction.Min(myRange) 
MsgBox answer

Worksheets for an Application object, returns a Sheets collection that represents all the worksheets in the active workbook.

MsgBox Worksheets("Sheet1").Range("A1").Value