Macros
Home ] Access - Start Here ] Excel In Depth ] MS Office ] Visio Info ] Creating Web Pages ] Technical References ] Viruses ] Points of View ] Gadgets ] Just Links ] Monash ]

   Search this site or the web       powered by FreeFind
 
  Site search Web search

Participate in Ananda's Discussions
Post a message

Monitor page
for changes
    
   it's private  

by ChangeDetection

Up
XLEvents

Add-Ins ] [ Macros ] User Forms ] Misc ]

What is a VBA Project?

There is a hierarchy of objects in VBA is.

The Excel workbook is the file everything is saved to. In the VBE
VBAProject
  Microsoft Excel Objects
    Sheet1 (hold modules specific to each sheet)
    Sheet2
    Sheet3
    ThisWorkbook (holds the module specific to the workbook.)
    Modules is a node to display the following
      Module1 is a module which you create
    Class Modules
      Class1 is a class module which you create
    UserForms
      UserForm1 is a userform which you create

To avoid confusion, you should customise these names. There are so many places where names can be embedded that this itself leads to confusion. In the VBE's Project Explorer window/pane, select the object (that you want to change the Codename of), press function key F4 to reveal the Properties Dialog - that's where you change the name. An Example is:

    prjFinance
        Microsoft Excel Objects
            basJan
            basFeb
            basMarch
            This Workbook
        Modules
            basLibrary
            basWINAPI
        Class Modules
            clsSaveRecord
        Forms
            frmMain
            frmEnquiry

Code modules associated with Sheets, Workbooks or Userforms do not expose variables to other modules - see Public Variables Are Not Seen on Modules for Sheet or UserForm

An interesting topic is XL97 File Size Increases After Launching Visual Basic Editor