Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
VBA Automation for Excel 2019 Cookbook

You're reading from   VBA Automation for Excel 2019 Cookbook Solutions to automate routine tasks and increase productivity with Excel and other MS Office applications

Arrow left icon
Product type Paperback
Published in Sep 2020
Publisher Packt
ISBN-13 9781789610031
Length 362 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Mike Van Niekerk Mike Van Niekerk
Author Profile Icon Mike Van Niekerk
Mike Van Niekerk
Arrow right icon
View More author details
Toc

Table of Contents (20) Chapters Close

Preface 1. Chapter 1: Getting Started with VBA 2. Chapter 2: Working with the VBA Editor FREE CHAPTER 3. Chapter 3: The VBA Object Model 4. Chapter 4: Working with Procedures 5. Chapter 5: Next Level Recording 6. Chapter 6: VBA Language Elements 7. Chapter 7: Working with Ranges 8. Chapter 8: Using Functions 9. Chapter 9: Implementing Program Flow 10. Chapter 10: Implementing Automation 11. Chapter 11: Handling Errors 12. Chapter 12: Debugging 13. Chapter 13: Creating and Modifying Dialog Boxes 14. Chapter 14: Creating UserForms 15. Chapter 15: UserForm Controls 16. Chapter 16: Creating Custom Functions 17. Chapter 17: Creating Word Documents with Excel VBA 18. Chapter 18: Working with PowerPoint in Excel VBA 19. Other Books You May Enjoy

Customizing the Editor tab to suit your preferences

In this recipe, we will change settings in the Editor tab to suit your preferences.

Getting ready

Make sure that the VBA Editor is visible.

How to do it…

In order to proceed with executing this recipe, you need to go through the following steps:

  1. With the VBA Editor active, choose Tools | Options from the menu bar. The Options dialog box will appear as shown here:
    Figure 2.23 – The Options dialog box

    Figure 2.23 – The Options dialog box

  2. In the Options dialog box, click on the Editor tab, if it is not already selected.

    There are two sections: Code Settings and Window Settings. In each of these sections, you will find several boxes, some with tick marks and others empty.

  3. Click in any of these tick boxes to select or deselect the option, as described to the right of the tick box:
    Figure 2.24 – The Editor tab

    Figure 2.24 – The Editor tab

  4. Click on the Editor Format tab to activate it. With this tab, you can customize the way the Editor looks.

    Here, you will find three sections: Code Colors, Font, and Sample.

    The options under Code Colors can be customized by selecting a different color under Foreground, Background, and Indicator for each of the code elements.

    The font and size can be changed by selecting either Font or Size, while a sample will display the effect of your choices in the Sample section, as shown:

    Figure 2.25 – The Editor Format tab

    Figure 2.25 – The Editor Format tab

  5. Click on the General tab to activate it. This is where the less dedicated settings can be made.

    In this area, you will find four sections: Form Grid Settings, Edit and Continue, Error Trapping, and Compile.

    Once again, changes can be made by either selecting or unselecting tick boxes, as shown:

    Figure 2.26 – The General tab

    Figure 2.26 – The General tab

  6. Click on the Docking tab to activate it. The only purpose of this tab is to set the behavior of the different windows in the VBA Editor.

    There is only one section with a list of tick boxes, each with a description:

Figure 2.27 – The Docking tab

Figure 2.27 – The Docking tab

How it works…

We will now have a quick look at what customizing these tabs entails.

The Editor tab

The default settings are default for good reasons and speak for themselves, in most cases. There are two possible changes I would suggest, which are as follows:

  • The Auto Syntax Check: For novice users, this option is indispensable, so keep it as it is. For people with more experience, the pop-up dialog box that appears when it discovers a syntax error in the code can be irritating. You choose what you prefer.
  • Default to Full Module View: Many coders prefer to see a maximized code window. However, if you know that you're going to work in multiple modules, it is sometimes nice to have the code window in restore down mode so that you can easily select and move between them.

The Editor Format tab

With this tab, you can customize the way the Editor looks. Once again, these settings are the default because they've been tried and tested.

So, unless you are working for a multi-national company where the project managers have developed their own color settings, I would strongly advise that you stick to the factory settings.

The General tab

In almost every case, the default setting will be best. There is, however, one setting that must be mentioned, and that is Error Trapping. The default setting is Break On Unhandled Errors. If you switch this off, your error handling code will not work. More on this will be covered later in the book.

The Docking tab

As said, these settings determine window behavior in the VBA Editor. When a window is docked, it is fixed in place in the VBA program window, meaning that your environment is fixed and familiar.

If you turn off all docking, windows in the VBA Editor can potentially become a confusing mess of floating screens. In this case, I would strongly advise against undocking windows.

You have been reading a chapter from
VBA Automation for Excel 2019 Cookbook
Published in: Sep 2020
Publisher: Packt
ISBN-13: 9781789610031
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime