|
VBA and Excel for Engineers and Scientists – Part 2 - Introduction |
|
|
|
Written by Randy Post
|
|
Tuesday, 20 May 2008 |
|
Page 2 of 12
Code Containers
There are several different container types for your VBA code. For now, well stick with the most common, a code Module. To create a code module, in the VBE, go to Insert->Module. In the Project Explorer on the left hand side, you should see at least one module for your XLS file, probably named Module1. You can change the name using the Properties window. If you dont see the Project Explorer or the Properties Window, go to the view menu.
Figure 1: Project Explorer
For your reference, other code containers are various different forms of modules such as Worksheet Code Modules, which I generally recommend you avoid for now, Form Modules, which are used if you want to create your own input/output forms , and Class Modules, which are used for object-oriented programming. As far as object-oriented programming is concerned, you will become at least somewhat familiar with it because there are many built-in Excel Objects you will need to interact with in your VBA coding. However, Im an engineer, not a programmer, so I am just looking for simple and functional code and I dont care if its elegant or not! Im guessing if youre reading this, you are probably in the same boat, so forget about Class Modules for now.
Trackback(0)
|
|
Last Updated ( Monday, 21 July 2008 )
|