This book uses the following programming style guidelines for code examples. For more information about Visual Basic code, see Chapter 1, "Modules and Procedures."
Sub HelloWorld Cells(1,1).Value = "Hello, world!" End Sub
' This is a comment; these two lines ' are ignored when the program is running.
' The AuditResult user-defined function is in the Finance module. Function AuditResult(latestIncome, expenses, taxes, commissions)
Argument and variable names appear with initial letters lowercase (to distinguish them from macro, function, property, method, and object names).
' Sub is a keyword. Sub Title(titleText) ' xlManual is a built-in constant. Application.Calculation = xlManual
Sub CheckRecordSound SoundRecordCapable = Application.CanRecordSounds If SoundRecordCapable Then Cells(1,1).SoundNote.Record End If End Sub
ActiveSheet.Rectangles.Add _ width:=200, _ height:=200, _ left:=50, _ top:=50