Office For Mac Visual Basic



  1. Office For Mac Visual Basic Tutorial
  2. Microsoft Visual Basic Download

The first option on the View menu of the Office 2011 for Mac Visual Basic Editor (VBE) is the Code option, which is grayed out until you make at least one Code window visible in the VBE. A common way to open a new code window is to use Insert→Module. A module is like a new word processing document window — it’s blank. Nothing interesting happens until you start writing. The same VBE features apply to Excel, Word, and PowerPoint.

Visual

Exploring the Office 2011 VBE Code Window

Office

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. The XML-based workbook format for Microsoft Excel 2008 for Mac, Microsoft Excel for Mac 2011, and Excel 2007 and Excel 2010 for Windows that preserves VBA macro code and Excel 4.0 macro sheets. VBA macros do not run in Excel 2008. Excel Macro-Enabled Template (.xltm).

Notice that horizontal lines separate the declarations section and each of the two macros. The lines are drawn automatically by the VBE. Each macro section is called a procedure. More about Code windows:

Office for mac visual basics
  • Object pop-up menu: This is the pop-up menu on the left side of the window; it provides a list of shortcuts to objects.

  • Procedure pop-up menu: This is the pop-up menu on the right side of the window; it provides a list of shortcuts to procedures and declarations. When an object is chosen in the Object pop-up menu, the procedures that are applicable to the selected object are displayed.

  • Declarations section: (Optional) Public declarations appear at the top of a Code module.

  • Macro modules: Each macro, or procedure, is separated by a line.

  • Procedure view button: Click to limit the display to the declaration or procedure section that has the insertion cursor.

  • Full Module view button: Click to display all Code window contents.

Writing VBA code in Office 2011 for Mac

As with a word processor, in a Code window the editor knows which commands are legal and which are not, and the editor gives you feedback as you type. New for VBA (Visual Basic for Applications) in Office 2011 is Intellisense, a feature that helps you automatically complete your code as you type. To see how Intellisense works, declare a public variable in an empty Code window:

Office For Mac Visual Basic Tutorial

  1. Choose Insert→Module to display a blank Code window.

  2. Type the following code exactly as you see it here and press Return at the end of the line:

Office

Notice that after you type as, a pop-up menu appears. This is Intellisense at work. If you know what you want to type, you can keep right on typing. But if you want to see all the possible options, use the pop-up menu.

Getting help with VBA code in Office 2011 for Mac

You can rely on the following five principal sources of code examples, syntax help, and general programming assistance:

Basic

Microsoft Visual Basic Download

  • Macro recorder: In Excel and Word, you can record your actions and then look at the code that was recorded inside the modules.

  • Object browser: A handy treasure trove of information about the objects, methods, and properties of Office.

  • Help: The Help system within the VBE is minimal. Microsoft plans to provide VBA help for Excel only.

  • Internet: Search the Internet for VBA code examples.

  • Books on VBA: You can find plenty of books about VBA.