Errata request for Office VBA Macros

Derek Brown

Well-known Member
Joined
Dec 26, 2005
Messages
2,390
There appears to be a section of code missing from the 'Outlook Porcedures' example on page 270/271 (creating 'New Button' to run 'MyMacro')of Office VBA Macros You Can Use Today.
An errata web page would be useful, please.
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Thanks for catching this. I will put together an errata page. In the meantime, here is the correct code:

Following code additionally shows how to create a custom control button in other Office applications.


Code:
'***********************************************************
'Copy and paste the following code into a standart module
'CreateCommandButton macro to create the new button
'RemoveCommandButton macro to create the new button
'***********************************************************
Option Explicit

Public Sub CreateCommandBarButton()

  'Remove the button if it is already existing
  Call RemoveCommandBarButton
  'Create new control button
  'Temporary:=True  : Available from now on
  'Temporary:=False : Available only this session
  With Application.CommandBars("Standard").Controls. _
                      Add(msoControlButton, Temporary:=True)
    'Caption to display on button
    .Caption = "New Button"
    'Procedure name to run when button is clicked
    .OnAction = "MyMacro"
    'Button Style - msoButtonCaption = 2
    .Style = 2
    'Show new button
    .Visible = True
  End With
End Sub


Public Sub RemoveCommandBarButton()
  'Error handler if control is not existing
  On Error Resume Next
  'Remove custom control button
  Application.CommandBars("Standard") _
              .Controls("New Button").Delete False
End Sub
 
Many thanks for the errata. Just love the book and have submitted a review on Amazon.co.uk
 

Forum statistics

Threads
1,222,697
Messages
6,167,702
Members
452,132
Latest member
Steve T

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top