Book Image

VBA Automation for Excel 2019 Cookbook

By : Mike Van Niekerk
Book Image

VBA Automation for Excel 2019 Cookbook

By: Mike Van Niekerk

Overview of this book

Visual Basic for Applications (VBA) is a programming language developed by Microsoft to automate tasks in MS Office applications. This book will help you to focus on the essential aspects of your role by automating mundane tasks in Excel and other Office applications. With comprehensive coverage of VBA delivered in the form of practice problems and bite-sized recipes, this book will help you to hit the ground running. Unlike most books that assume prior programming experience, this book starts with the fundamentals and gradually progresses to solving bigger problems. You’ll start by becoming familiar with VBA so that you can start recording macros right away. With this foundation in place, you’ll advance to using the full capabilities of the language as you apply loops, functions, and custom dialog boxes to design your own automation programs. You'll also get to grips with embedded macros and other advanced tools to enhance productivity and explore topics relating to app performance and security. Throughout this VBA book, you’ll cover multiple practice projects in Excel, Word, and PowerPoint while exploring tips and best practices to hone your skills. By the end of this book, you’ll have developed the skills you need to use VBA to create your own programs that control MS Office applications.
Table of Contents (20 chapters)

What this book covers

Chapter 1, Getting Started with VBA, gives a general introduction to VBA, and how to go about recording and editing a macro.

Chapter 2, Working with the VBA Editor, shows us how to work with and customize the VBA Editor.

Chapter 3, The VBA Object Model, gets us familiar with objects in VBA.

Chapter 4, Working with Procedures, shows us how to write Sub procedures manually.

Chapter 5, Next Level Recording, discusses recording macros with relative or absolute referencing.

Chapter 6, VBA Language Elements, introduces us to VBA language elements.

Chapter 7, Working with Ranges, gives us an understanding of cells and named ranges, as well as referring to ranges in VBA.

Chapter 8, Using Functions, tells us the difference between Sub procedures and functions, and covers writing a simple VBA function.

Chapter 9, Implementing Program Flow, covers the implementation of program flow principles in your VBA Sub procedures.

Chapter 10, Implementing Automation, introduces us to writing event handler procedures.

Chapter 11, Handling Errors, introduces us to error handling in VBA, with practical code samples.

Chapter 12, Debugging, identifies different bugs in VBA, and uses various debugging techniques to eliminate bugs.

Chapter 13, Creating and Modifying Dialog Boxes, creates every possible type of message box and input box imaginable.

Chapter 14, Creating UserForms, introduces us to UserForms. We'll cover setting up a form, creating labels and text boxes, and using lookup fields and frames.

Chapter 15, UserForm Controls, brings life to UserForms by adding controls, namely, Combo Boxes, SpinButtons, date options, and command buttons.

Chapter 16, Creating Custom Functions, takes functions to a new level of automation, including a look at calling functions from Sub procedures.

Chapter 17, Creating Word Documents with Excel VBA, examines activating MS Word from within Excel VBA, opening a new document, and transferring Excel content to Word.

Chapter 18, Working with PowerPoint in Excel VBA, shows you how to activate MS PowerPoint using only Excel VBA commands, then create a new presentation and slide show with content from Excel.