Sunday 17 June 2012

Lesson2: The Project Window in the Visual Basic Editor


As you can see, the Project window shows you all the workbooks that are open ("Book1") in the example below) and their components. You can use the + and - signs to show the details.A new Excel workbook includes three sheets and another component named "ThisWorkbook". As we will see later  in lesson 9 on events "ThisWorkbook" is a component in which you will store the macros ( also called VBA procedures) that should start automatically when the workbook is opened.






Working within the Project WindowWe will now complete a brief exercise to learn how easy it is to work within the Project Window.Exercise 2 (Create your first macro and use it)Step 1: Using the ALT/F11 key go back to Excel.Step 2: Add a sheet. Right-click on the tab of Sheet2 and select "Insert". 


Step 3: In the dialog window that appears, click on "OK".

Step 4: Using the "ALT/F11" key, go back to the Visual Basic Editor and see that a sheet has been added to the workbook. Notice that the worksheets are sorted alphabetically in the Project window even if they are not in the workbook.
In the complete lesson 2 you will learn how to add any type of components and how to remove, import, export and manage them from the Project window.Close the VBE and close Excel without saving anything.


No comments:

Post a Comment