ID: Q188835
The information in this article applies to:
The user interface for Microsoft Visual Basic for Applications in Microsoft Excel 98 has changed significantly from earlier versions of Microsoft Excel. This article describes the changes in the Visual Basic for Applications environment in Microsoft Excel 98 Macintosh Edition.
The components that make up Microsoft Visual Basic for Applications are the Visual Basic Editor, the forms interface, and the Visual Basic for Applications language.
The Microsoft Visual Basic Editor uses the programming interface of Microsoft Visual Basic 4.0 as a base for creating and editing code. Within the Visual Basic Editor, there are five major elements: Project Explorer, Property Window, Code Window, Object Browser, and Debugging Tools.
When you create code for a Microsoft Excel workbook, it is associated
to that workbook through a project. You can use the Project Explorer
as a navigational and management tool to display a hierarchical list
of each open project. It shows you each of the components associated
with those projects, such as worksheets, forms, class modules, and
references.
The Property window displays properties for the active object (user
form or control). In earlier versions of Microsoft Excel, you must
programmatically set most properties; however, in Microsoft Excel 98,
you can set many of these properties through the Properties window.
In the Property window, properties may be listed alphabetically or by
category.
You can no longer insert module sheets into a workbook.
In Microsoft Excel 98, a Code window is provided for each workbook,
for individual worksheets, and for general modules, class modules,
and forms. The Code window includes two list boxes: one (left) to
identify the object with which the code is associated, and
one (right) to identify the procedure.
To activate a Code window, use one of the following methods:
- Double-click the object for which you want to write or edit
code.
-or-
- Click to select the object. On the View menu, click Code (or
press F7).
-or-
- Press Control and click the object, and then click
View Code on the shortcut menu.
For compatibility with earlier versions of Microsoft Excel, you can
insert and run Microsoft Excel 4.0 Macro sheets in a workbook.
Microsoft Excel 5.x and 7.x module sheets are hidden in the workbook
interface and the code on them is transferred to code modules in the
Visual Basic Editor. This code will also run normally.
The Object Browser in Microsoft Excel 98 is similar to the Object
Browser in earlier versions of Microsoft Excel with the following
functionality additions:
- It allows you to differentiate between built-in properties,
methods, and user-defined procedures.
- It indicates which items are globally accessible.
- It shows you the function return types, parameter names and types,
and user defined types and constants.
- It has a modeless window so that other activities can run
while the browser is displayed.
- It allows you to view all available type libraries.
-and-
- It includes a Find feature that allows you to search for objects
across libraries.
The debugging tools in Visual Basic Editor include the Immediate
window and the following additional tools:
- Margin Indicators visually indicate current lines of execution.
-and-
- You can tile the Immediate window.
Earlier versions of Microsoft Excel used Dialog sheets to create custom forms. In Microsoft Excel 98, you can use dialog sheets for compatibility with earlier versions of Microsoft Excel; however, you can now use user forms to create custom forms that you can use in Microsoft Excel 98, Microsoft Word 98, and Microsoft PowerPoint 98.
The following is a list of advantages of using user forms:
Microsoft Visual Basic for Applications Programming developed for
Microsoft Office 98 uses Microsoft Visual Basic 4.0 as its
foundation. Many elements found in Visual Basic 4.0 are now
incorporated into Visual Basic for Applications, such as user defined
class modules, user defined collections, and custom properties.
The three member types of all Visual Basic for Applications object
models are Methods, Properties, and Events. Events have been expanded
beyond the Click, Show, and Change events that were available in
earlier versions of Microsoft Excel. Examples of new events are
Activate, BeforeDoubleClick, SheetChange, Open, WindowActivate,
MouseUp, MouseDown, and Calculate.
Visual Basic for Applications also supports extended objects in
Microsoft Excel 98. An extended object is an object that has code
attached to it. You can attach code to Workbooks and worksheets.
Code behind objects uses extended objects to enhance Visual Basic for
Applications programming by:
- Directly and exclusively attaching a code module to an object.
- Directly attaching forms to an object.
- Using Properties and Methods of the object without need for the
name of the object to which the code is attached.
- Providing a unified user model for writing event handling code for
the object and for the controls inside the object.
There are several advantages to code behind objects. Code is moved,
copied, and saved with the object to which it is attached. Simpler
syntax can be used to refer to properties and methods of the objects
because the code is attached to the object. For example, in earlier
versions of Microsoft Excel, if programming code referred to
"Worksheets("Sheet1")" and Sheet1 was renamed to "First Sheet", all
code referring to Sheet1 would generate an error. With code attached
to the object, when Sheet1 is renamed, the code attached to it still
runs without you having to edit the code.
http://support.microsoft.com/support/macexcel/content/MacVBA/MacVBA.asp
Additional query words: XL98 VBA VBE VB Editor project explorer
Keywords : kbprg kbdta xlui xlvbainfo
Version : MACINTOSH:98
Platform : MACINTOSH
Issue type : kbhowto
Last Reviewed: July 16, 1998