Errata

Writing Excel Macros

Errata for Writing Excel Macros

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date submitted
Printed Page xvii
End of last paragraph

This sentence didn't make sense to me, "Would that the software industry had this good a record!"

Anonymous   
Printed Page 50
1st paragraph

The example of the code does not match the description just preceding it. The
paragraph talks about line continuation by the underscore symbol, but no such
symbol appears in the example.

Anonymous   
Printed Page 74
Second sentence of Optional Arguments: "It makes no sense... "

We are told that "It makes no sense to say that a parameter is optional". This seems
to be contradicted later.

See p. 75, middle of page. "... where all the parameters are optional".

And p. 83, first sentence under table 7.2. "... to indicate optional parameters."

Anonymous   
Printed Page 75
6th line of text

I believe the procedure call should be 'ChangeFormatting' and not 'ChangeFormat' ..

Anonymous   
Printed Page 75
Second sentence under Named Arguments

"For example, one form of the Excel SaveAs function has the declaration:"

Surely this is a subroutine, not a function?

Anonymous   
Printed Page 100
In the first paragraph, the first second of example code currently

reads "For ObjectVar in CollectionName."

It should read "For Each ObjectVar in CollectionName" since the original
syntax is incorrect and will error.

Anonymous   
Printed Page 101

The code in the third paragraph that reads:

i = 1
Do While IsEmpty (activesheet.rows(1).Cells(i))
i = 1 + 1
Loop
...

Should read:

i = 1
Do While NOT IsEmpty ...
i = 1 + 1
Loop
...

to execute as described (and find the first empty cell on the first row)
The Not is present in the second example a little below.

Anonymous   
Printed Page 103
Table 8-1

Function is FileDateTime, not FileTimeDate (Excel 2000).

Anonymous   
Printed Page 109
2nd and 4th paras, table 9-1

The text quotes "rows collection" and the table shows "range" collection - surely
there are no such objects. Rows is a property, and
range is an object. They may appear to be collections in that they contain multiple
objects, they are surely NOT VBA collections.

Anonymous   
Printed Page 128
Sentence starting " When the Book.xlt template is stored ..."

"see Figure 10.2" should be "see Figure 10.4".

Anonymous   
Printed Page 136
Implementing the Features of the Ad-In

Code module "basMenus" is cited as "basMain".

Anonymous   
Printed Page 143
Item 1. of procedure for reaching the code event shells for

application events;

Item one says to insert a class module into your project & call it CApp. In
declaration section of the class module add the line: Public WithEvents App
As Application

OK, I did so... added it to the CApp module, and the line of text turned
red and a message scorned me: "Compile error" "Only valid in object module".
But I was able to add the line successfully to the
ThisWorkBook object without upsetting the evil spirits.

Anonymous   
Printed Page 157
Example 12-6, Example 12-8

Dim cvctl as CommandBarControl ' INCORRECT

'should be:

Dim cbctl as CommandBarComboBox

Anonymous   
Printed Page 162
In line 3 of the last paragraph I believe the reference should be to

the "onAction Proc" column in Figure 12-5, not the "onActivation Proc" in
Figure 12-3.

Anonymous   
Printed Page 163
Line 23 of Example 12-12

In Example 12-12 (The CreateCustomMenu Procedure), the tag of the Custom menu
is set to "SRXUtilsCustomMenu" which is inconsistent with Example 12-17 (The
DeleteCustomMenus Procedure), which tries to delete a ControlPopup with Tag
"TestAddInCustomMenu."

The example code from the O'reilly site correctly reflects the tag as
"TestAddInCustomMenu."

The result is that the code will not properly delete the Custom toolbar popup
control when the Add-In is unloaded. This can be remedied by exiting Excel.

Anonymous   
Printed Page 165
The fifth to last line on the page in Example 12-14 now reads:

Application.Run WkbName & "!" & ProcName

This program line only works for me when the procedure exists in an external
*.xls or *.xla file. If the procedure name to be executed exists in the file
actually running this VBA program, then an error occurs - in that the
procedure is not found. Eliminating the "!" solves the problem, but then
procedures in external files are not found. Unless I am missing something,
it seems necessary that this program line needs to be modified with
additional code added to provide for locating procedures in both the current
file and in any external files.

Anonymous   
Printed Page 167
In lines 4 and 7 of Example 12-17 the appearance of

Tag:="TestAddInCustomMenu" is inconsistent with the tag designation made in
Example 12-11, which is Tag:="SRXUtilsCustomMenu." As a result of this
inconsistency the Custom menus are not deleted as expected.

Anonymous   
Printed Page 169-172
whole pages

The alphabetical ordering of the built-in dialogs has been done on a page-to-page
basis, rather than alphabetizing the whole of table 13-1. The result is that, for
example, page 170 contains "xlDialogAttachText" to "xlDialogSetBackgroundPicture,"
and pg. 171 contains "xlDialogCopyChart" to "xlDialogWorkbookAdd."

Anonymous   
Printed Page 182
Table 14.1

The book tells us to change the Name proerty in the newly created list box to
1stSheets. When I do this, I get an error message saying "Not a legal option
name: '1stSheets'."

Anonymous   
Printed Page 211
CalculateBeforeSave property

The variable referenced should be xlCalculationManual, not xlManual.

Anonymous   
Printed Page 226
4th paragraph

The following code to create a name object that refers to a range on Sheet1 of Book1 has two major errors in it:

Workbooks("Book1.xls").Names.Add Name:="WkBkName" RefersTo:="=Sheet1!$A$1:$B$1"

Error1:

"Book1.xls" should be just "Book1"

Error2:

Name:="WkBkName" needs a comma, ie:

Name:="WkBkName",

Anonymous   
Printed Page 226
6th paragraph

The following code to a name object to the names collection of both Sheet1 and Sheet2 has one two serious technical errors in it. I consider these to be serious technical errors because the code has a runtime error.

Workbooks("Book1.xls").Worksheets("Sheet1").Names.Add Name:="WkSheet1Name", _
RefersTo:="=Sheet1!$A$1:$B$1"
Workbooks("Book1.xls").Worksheets("Sheet2").Names.Add Name:="WkSheet2Name", _
RefersTo:="=Sheet2!$A$1:$B$1"

In each case the code should read:

Workbooks("Book1")... etc

Anonymous   
Printed Page 228
The second paragraph states that ActiveWorkbook must be true for

SyncHorizontal to be evaluated, but the example command below this paragraph
omits ActiveWorkbook. It must be explicitly included.

Anonymous   
Printed Page 247

The last sentence of the last paragraph reads:

"It displays the dialog box shown in Figure 17-8."

However, Figure 17-8 is a worksheet, not a dialog box, and it was referenced
correctly two paragraphs earlier. There is no figure with the dialog box.

Anonymous   
Printed Page 328
The control "optNotEmpty" is missing from the list of control names.

Anonymous   
Printed Page 328
In the control names list, the 6th entry should be "cmdClose," not

"cmdCancel."

Anonymous   
Printed Page 438
In line 1, the author states that you cannot change the text of a

legend entry. However, you can easily do this by:

ActiveChart.SeriesCollection(1).Name = "text"

This will change the series name and therefore the legend entry as well.

Anonymous   
Printed Page 452
In the second paragraph under the "Example" heading, the parenthesized

note reads "with some data such as that in Figure 21-6." However, Figure 21-6
is the z-order. This should probably refer to Figure 21-5.

Anonymous   
Printed Page 477
Example A-4

The variable rng is defined but not used.

This also occurs in example A-5. In example A-6, it is defined and initialized
to ActiveCell, but then never referenced.

Anonymous   
Printed Page 485
In the last line of the first paragraph, change "loose" to "lose."

Anonymous   
Printed Page 515-516
Fortran example

In all the Fortran compilers I've used, the C comment character must be in
column 1, and the logical expression in the IF statement must be enclosed in
parentheses.

Anonymous