Display and Navigate the VBE Interface in Office 2011 for Mac - dummies

Display and Navigate the VBE Interface in Office 2011 for Mac

By Geetesh Bajaj, James Gordon

Office 2011 for Mac’s Visual Basic Editor (VBE) is very much like a specialized word processor combined with an organization tool and some special tools to help you make visual basic code. To display the VBE using the Ribbon, click the Developer tab, and in the Visual Basic group, and click Editor. From the menu bar, choose Tools→Macro→Visual Basic Editor.

The VBE has menus, toolbars, and keyboard shortcuts, but there is no Ribbon. As with Office applications, VBE toolbars and menus are context sensitive.

As with Office applications, you can turn VBE interface components on and off using the View menu. Be sure to toggle on the Debug, Edit, and Standard toolbars as shown. Notice that keyboard shortcuts are displayed on the View menu.

image0.jpg

The Standard toolbar in VBE, in Office 2011 for Mac

Some of the controls on the Standard toolbar in VBE are familiar text-editing controls. The rest are specific to working within the VBE.

image1.jpg

  • Host Application: Takes you out of the VBE and displays the document, spreadsheet, or presentation view.

  • Insert: Inserts into the current Project a new UserForm, Module, Class Module, or Procedure. This button remembers which you inserted last and offers the most recently used as its default.

  • Save: Saves the document, workbook, or presentation of the Project that is currently selected in the Project Explorer.

  • Cut, Copy, Paste, and Find: Work similar to other applications.

  • Run: Click into a module (procedure) and then click Run to run your code.

  • Break: Interrupts code execution. Click Run or press F5 to resume, or click Step Over on the Debug toolbar to execute one command at a time.

  • Reset: When in Break mode, Reset ends the break and resets so that if you click Run again, code execution starts at the beginning.

  • Design Mode: In Design mode, the Break and Reset commands are disabled.

  • Project Explorer: Switches focus to the Project Explorer.

  • Properties Window: Displays the Properties window.

  • Object Browser: Displays the Object Browser.

  • Help: Displays VBA help.

  • Line and Column: You can think of a code module as a grid, with each character that you type at a specific location (line and column) within the grid. The cursor’s position is always displayed here. This is blank if your selection cursor is not in a code module.

The VBE Edit toolbar in Office 2011 for Mac

This toolbar focuses on editing code and making it easier to read with indenting.

image2.jpg

  • Indent/Outdent: Applies to selection. Indenting is not automatic.

  • Breakpoint toggle: Adds or removes a breakpoint at the selection and is represented by a circle in the margin. If you run code, execution halts at a breakpoint. Press F5 or click Run to resume. Clicking in the margin adds a breakpoint. Clicking a breakpoint in the margin removes it.

  • Comment/Uncomment: Comment turns selection into a comment, which is text that does not execute when run.

  • Bookmark Toggle: Sets or removes a bookmark, represented by an oval in the margin.

  • Next Bookmark/Previous Bookmark: Navigation for bookmarks.

  • Clear All Bookmarks: Removes all bookmarks from the module.

The Office 2011 for Mac VBE Debug toolbar

The VBE Debug toolbar shares several tools in common with the Standard and Editing toolbars.

image3.jpg

  • Step Into: Sets code execution at the first line of code.

  • Step Over: Executes one line of code each time it is pressed. This is the same as Command-Shift-O.

  • Step Out: Stops code executing. Same as Command-Shift-T.

  • Immediate Window: Displays the Immediate Window, where you can enter a code snippet followed by a question mark to see its result.

  • Call Stack: Displays the Call Stack dialog, an advanced debugging tool that you won’t need to worry about until you’re an expert.