4.3. Creating A Procedure For Excel

The procedure you'll create for Excel is short but helpful: when the user runs Excel, the procedure maximizes the Excel window and opens the last file worked on. The procedure also illustrates some useful techniques, including how to:

  • Write a macro that executes when an application first starts up

  • Work with events

  • Use the Object Browser to find the objects, methods, and properties you need

Follow these steps to create the procedure:

  1. Start Excel if it's not already running.

  2. If your Personal Macro Workbook is currently hidden, click the Unhide button in the Window section of the View tab on the Ribbon. Select PERSONAL.XLSB in the Unhide Workbook list box, and then click the OK button.

  3. Press Alt+F11 to open the Visual ...

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

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.