Getting the Most Out of Visual Basic for Applications
As a developer, your goal is to write code that's fast, efficient, easy to read and maintain, and if possible, reusable. To do so, you need a solid working knowledge of Visual Basic for Applications (VBA)—what features the language includes, and what you can do with it.
As you develop solutions, you'll find that there are a number of operations that you need to perform repeatedly—parsing a file path, for example, or returning all the files in a directory. Rather than rewriting these routines every time you need them, you can begin building an arsenal of procedures that solve common problems. This chapter gives you a head start by providing functions that perform some often-needed operations on strings, numbers, dates and times, files, and arrays. It also explains the key aspects of each procedure and covers fundamental VBA programming issues so that you can continue to expand your code arsenal yourself. You can use these procedures not only in VBA code but also in Microsoft Visual Basic Scripting Edition (VBScript) code in HTML documents.