Creating code

Program code -- the statements that tell the program what to do - is contained in the Code window of the VBA IDE. It can be displayed any of the following methods:

Once inside the Code window, you can create code by typing in VBA statements, copying and pasting code from other sources, or using Intellisense to place items. If you open the Code window by double-clicking a control that has no code yet associated with it, the first and last lines of a subroutine are created for the control, such as the following lines for a command button:

 

Private Sub CommandButton1_Click()

 

End Sub

 

Tell me about...

VBA (Visual Basic for Applications)

Overview of automation

Starting VBA

Inserting UserForms

Adding controls to a UserForm

Using modules

Managing VBA projects

Running a VBA program

 


© Bricsys NV. All rights reserved.