Other topics about Operation Basics
Project Explorer displays a list of files (modules) that are used in the E5071C VBA. This section describes a project composed of a number of files (modules) and three types of modules ("user form", "standard," and "class"). Each type of module serves its own purposes as described below.
When you develop an application within the E5071C's VBA environment, you use a number of VBA program files (modules), and manage them as one project. The project is saved with the file extension ".vba".
A user form contains controls such as buttons and text boxes. You can code event-driven procedures that are invoked when a particular event occurs on a particular control, thereby creating a user interface. The user form is saved with the file extension ".frm".
A standard module contains a collection of one or more procedures (subprograms enclosed between Sub and End Sub). One typical use of a standard module is to contain shared subroutines and globally called functions. The standard module is saved with the file extension ".bas".
A class module contains both data and procedures and acts as one object. Once you have created a class module that serves as an object, you can create any number of instances of that object by naming each instance as an object variable. While each procedure must be unique in a standard module, you can have multiple instances of an object created through a class module. The class module is saved with the file extension ".cls".
The code windows appear on the Visual Basic Editor by inserting the modules in a project. You can do coding (programming) on this code windows practically.
The E5071C's VBA environment does not allow you to manage multiple projects. When the current project is existing in the Visual Basic Editor by loading the saved project file, you can replace the current project with a new project by the following method from the E5071C measurement screen.
Macro Setup > New Project
When you replace the current project with a new project, the message whether or not the current project is saved may appear. If you want to save the project, click Yes button to display a dialog box for saving. For saving the project, see Saving a Project.
Within Visual Basic Editor, do one of the following to add a user form to your project.
On the Insert menu, click UserForm.
On the toolbar, click "Insert User Form/Standard Module/Class Module/Procedure" icon, and click UserForm.
In Project Explorer, right-click the "VBAProject" icon, and click Insert > UserForm.
Adding a user form does not automatically open the code window for that user form. To open the code window, click the "Display Code" icon on Project Explorer in the following figure or double-click a control placed on the user form.
Within Visual Basic Editor, do one of the following to add a standard module to your project.
On the Insert menu, click Module.
On the toolbar, click "Insert User Form/Standard Module/Class Module/Procedure" icon, and click Module.
In Project Explorer, right-click the "VBAProject" icon, and click Insert > Module.
Adding a standard module/class module
Within Visual Basic Editor, do one of the following to add a class module to your project.
On the Insert menu, click ClassModule.
On the toolbar, click "Insert User Form/Standard Module/Class Module/Procedure" icon, and click ClassModule.
In Project Explorer, right-click the "VBAProject" icon, and click Insert > ClassModule.
You can delete any unnecessary module from the project within Visual Basic Editor. The following procedure assumes that you want to delete a class module named "Class1".
In Project Explorer, click the "Class1" class module under the "Class Modules" icon to highlight it.
Delete the "Class1" class module using one of the following methods:
On the File menu, click Remove Class1....
Click the right mouse button, and click Remove Class1....
When you are prompted to confirm whether to export (save) "Class1", click No. Alternatively, you can click Yes if you want to save the module.