What Is an Excel Application

First of all, I should define what I mean by an Excel application. By Excel application, I mean a spreadsheet that you have developed using Excel and VBA for use by yourself or other users. VBA stands for Visual Basic for Applications, which is essentially Visual Basic that has been modified to run within other host applications such as Excel or Microsoft Word. Excel applications contain VBA code that may perform one or more of the following tasks Automate tedious processes. Many times, once...

Listing Using the Interior Object to Alter the Background of a Range

Microsoft Office Ehcel

Sub InteriorExamp1e Dim rg As Range ' create examples of each pattern Set rg _ Range ListStart .Offset 1, 0 ' create examples of each VB defined color constant Set rg _ 0 rg.0ffset 0, 2 .Interior.Co1or rg.0ffset 0, 1 .Va1ue Set rg rg.0ffset 1, 0 rg.0ffset 0, 2 .Interior.Pattern rg.0ffset 0, 1 .Va1ue rg.0ffset 0, 3 .Interior.Pattern rg.0ffset 0, 1 .Va1ue rg.0ffset 0, 3 .Interior.PatternCo1or vbRed Set rg rg.0ffset 1, 0 This listing loops through two lists that I've created on a worksheet named...

Object Inspection Using the Object Browser

Take Your Own Inventory

When you develop in Excel with VBA, your programmatic interaction with Excel consists of manipulating or using Excel's various objects. Excel has many, many objects available for you to manipulate. Without any other information, you can probably surmise that a worksheet object represents worksheets and a workbook object represents workbooks. One way you can see what other objects are available is to use the Object Browser. An example of the Object Browser is shown in Figure 2.12. To display the...

Listing Link Status Checker

Function GetLinkStatus wb As Workbook, sLink As String As String Dim avLinks As Variant Dim nIndex As Integer Dim sResult As String Dim nStatus As Integer ' get a list of link sources avLinks wb.LinkSources xlExcelLinks ' make sure there are links in the workbook If IsEmpty avLinks Then GetLinkStatus No links in workbook. Exit Function End If ' default result in case the link is not found sResult Link not found. For nIndex 1 To UBound avLinks If _ StrComp avLinks nIndex , sLink, vbTextCompare 0...