Microsoft Office Tutorials and References
In Depth Information
Writing Your Own VBA Procedures
Figure 2-8:
dialog box.
3. In the Name field, type a name for the procedure.
The name can be anything you choose, but it must start with a letter and
can’t contain any blank spaces.
4. In the Type section, choose Sub to create a sub procedure or Function
to create a function procedure.
The Property option has to do with creating custom objects, which isn’t
relevant to the topic at hand.
5. In the Scope section, choose Public (to make the procedure available
to all Access objects) or Private (to make the procedure visible only to
the current module).
If you’re not sure whether to choose Public or Private, choose Public.
Private procedures generally are used only in class modules, not
standard modules.
6. Select the All Local Variables As Statics check box if you want to
ensure that variables in the procedure retain their values between calls.
If you’re not sure what to do with this option, your best bet is to leave it
7. Click OK.
You see a new, empty procedure in the Code window.
If you chose the Function procedure type in Step 4, the procedure looks
something like this:
Public Function name ()
End Function
If you chose the Sub procedure type in Step 4, the code looks something like
Search JabSto ::

Custom Search