• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 3. Excel Solution Development > Objects, Properties, and Methods

Objects, Properties, and Methods

The Application Object

The Application object refers to Excel itself and is manipulated for tasks that affect the overall use of Excel. Some examples of this are the DisplayAlerts property, the ScreenUpdating property, the Cursor property, and the Quit method. The routine in Listing 3.1 gives an example of using the Application object. Other Excel objects, methods, and properties that are in this routine are explained in the appropriate sections of this chapter.

Listing 3.1. Setting application properties, deleting and adding sheets, copying and pasting data

With Application
  .ScreenUpdating = False
  .DisplayAlerts = False
  On Error Resume Next
  Sheets("Working Data").Delete
  On Error GoTo error_end
  ActiveWorkbook.Worksheets.Add
  ActiveSheet.Name = "Working Data"
  Sheets("Download Data").Activate
  Cells(1, 1).Activate
  ActiveCell.CurrentRegion.Select
  Selection.Copy
  Sheets("Working Data").Activate
  Cells(1, 1).Select
  ActiveSheet.Paste
  Cells(1, 1).Select
  Sheets("Download Data").Delete
  ActiveWorkbook.Save
  .Quit
  Exit Sub
error_end:
  .ScreenUpdating = True
  .DisplayAlerts = True
  MsgBox Err.Description
End With


					  


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint