Chapter 10

Creating Your Own Functions

In this chapter, you’ll learn how to create your own functions. You’ll create a function just like you create a procedure: by working in the Code window for the module in which you want to store the function. (You can’t record a function, even if the application you’re using hosts the Macro Recorder — you have to write it.)

This chapter starts by explaining the components of a function and showing you how to put them together. You’ll then create some functions that work in any VBA host and some functions that are specific to Word, Excel, and PowerPoint.

In this chapter you will learn to:

  • Understand the components of a function statement
  • Create a generic function
  • Create a function for Word
  • Create a function ...

Get Mastering VBA for Microsoft Office 2007, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.