10.8. The Bottom Line

Understand the components of a function statement Arguments can be passed from the calling code to a function in one of two ways: by reference or by value.

Master It What is the difference between passing data by reference or by value?

Create a generic function You can write, and save (File Export File), sets of generic functions that work in any VBA-enabled application.

Master It Create a function that displays the current year in a message box. This function will require no arguments, nor will it return any value.

Create a function for Word Word contains a whole set of objects and members unique to word processing tasks. Functions that are specific to Word employ one or more of these unique features of the Word object model.

Master It Write a function that displays the number of hyperlinks in the currently active document. Use Word's Hyperlinks collection to get this information.

Create a function for Excel Excel uses an ActiveWorkbook object to represent the currently selected workbook. You can employ a full set of built-in methods to manipulate the features of any workbook.

Master It Using the Sheets collection of Excel's ActiveWorkbook object, write a function that displays the number of sheets in the current workbook.

Create a function for PowerPoint PowerPoint's object model includes an ActivePresentation object, representing the currently selected presentation. Functions can make good use of this object and its members.

Master It Write a function that returns how many slides are on a presentation. Pass the ActivePresentation object as an argument to this function, then you display the number of slides the presentation contains. Call this function from a subroutine.

Create a function for Access Access often works a little differently from other VBA-enabled Office applications. For example, some common tasks are carried out by using methods of the special DoCmd object rather than methods of a Form or Table object.

Master It Write a function that closes Access by using the DoCmd object's Quit method. Ensure that all data is saved by employing the acQuitSaveAll constant as an argument for the Quit method.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.142.199.163