O'Reilly logo

Mastering VBA for Microsoft® Office 2010 by Richard Mansfield

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 10. Creating Your Own Functions

In Chapter 9, you learned how to use VBA's built-in functions. In this chapter, you'll learn how to create your own functions. As you'll see, you create a function just like you create a subprocedure: by working in the Code window in the module in which you want to store the function. (You can't record a function in Excel and Word—the applications that provide a Macro Recorder. Instead, you have to write functions yourself because the two recorders create only subprocedures.)

It's important to note that, although both are procedures, functions differ from subs. The primary difference is that functions interact more with other procedures: They accept arguments (incoming data) from the procedure that calls ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required