1 / 5

Chapter 3

Chapter 3. The Visual Basic Editor. Important Features of the VBE. Alt-F11 will open the Visual Basic Editor. The Code window is to the right, Project Explorer window and the Properties window.

kameko-best
Download Presentation

Chapter 3

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 3 The Visual Basic Editor

  2. Important Features of the VBE • Alt-F11 will open the Visual Basic Editor. • The Code window is to the right, Project Explorer window and the Properties window. • Project Explorer displays a list of all open projects. Doubling-clicking on a particular sheet will open up the appropriate code window . • Below a given project, the Project Explorer window shows its “elements”. • These include an element called ThisWorkbook, and any modules (VBA code), user forms (for dialog boxes), or references associated with the project. • The Properties window lists a set of properties for the selected object. • For example, the Sheet object has twelve properties listed. • The VBE has three very useful toolbars: the Standard, Edit, and Debug toolbars. • Standard tool bar-run, pause, or stop a program you have written. • Also, allows you to display the Project or Properties windows if hidden. You can also display the Object Browser and the Control Toolbox. • Editing toolbar allows indenting or outdenting, comment or uncomment blocks of code in addition to the usual editing features of copy, paste, clear, cut, find, replace to mention a few. • Debug toolbar allows you to track down errors in you program code that are not apparent. • Other useful menu items include Insert/Module and Insert/UserForm.

  3. The Object Browser • Contains a list of object model libraries. • The Excel and VBA libraries will be of the most importance. • The Excel library provides help on all of the objects , their properties and methods in the Excel object model. • The VBA library provides help on the VBA elements that are common to all applications that can use VBA: Excel, Access, Word, Powerpoint to name a few. • A property is denoted by a hand icon and a method is denoted by a green rectangular icon. • You can receive help by clicking on the question mark icon.

  4. Immediate and Watch Windows • Immediate window can enter one-line VBA commands. • Press Enter and the command takes effect immediately. • Precede the command by a question mark and you will get an immediate answer to a question. • Debug.Print followed by something to be printed to the Immediate window. You can use this to check the output at various points in the program. • Watch window is used for debugging. Programs have several variables that change values over time. • If the program is not running properly, you can put a watch on one or more key variables to see how they change as the program progresses

  5. A First Program • Open the file • Get into the VBE (Alt+F11) • Add a module • Start a Sub • Type the code • Run the program from the VBE • Run the program with a button • Save the file

More Related