VBA application object in Excel
The "Application" is the root of any application where the program code is executing.
It has different meanings with different applications.
For example, with Excel VBA, The "Application" object refers to the entire Excel application.
This means, "Application " object is not bound only to the excel containg macro code.
Similarly, In MS Word, The same "Application" object refers to the entire MS Word.
The same is the case with MS Access VBA too.
There are numerous uses of this object and it offers a large number of functionalities some of which are discussed below:
1.Application.ScreenUpdating
The ScreenUpdating property of Application object is used to set the visual updation of the excel workbook to either TRUE or FALSE.
This property is useful while modifying a workbook with values and then saving it.
In this case, the excel screen will flicker while the program is executing and is not visually pleasing.
So, to avoid this, the ScreenUpdating property has to be set to FALSE.
Application.ScreenUpdating=False
2.Application.DisplayAlerts
This is also a useful member of the Application object.
With this, one can control the display of unwanted alert dialogs, which will hinder the speed of the program.
For example, while deleting a sheet, the excel usually displays a dialog box giving a warning and will proceed further only after an user action of a button click.
So, to avoid this during automation, the "DisplayAlerts" property is used, which if set TRUE, will not show the dialogbox and will automatically accepts the OK button click.
The same is the fact with Saving an excel.
Application.DisplayAlerts=False
If you see at the very first lines of this VBA Editor, you can see these two statements.
A screenshot of this is shown as below: