Designing Code to Be Used Again

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

The following topics cover techniques you can use to transform your code into reusable components.

These topics are designed to get you started writing code that can be used in different situations.

In This Section

  • What Is Reusable Code?
    Reusable code is code that can be used, without modification, to perform a specific service regardless of what application uses the code.
  • Writing Reusable Code
    There are many ways to write code that performs some valuable service.
  • Source Code Sharing
    Whether you are working on a team or by yourself, you can integrate source code control, code sharing, and code reuse for your projects, simplifying just about any development project.
  • Writing Solid Code
    "Writing solid code" means writing Microsoft® Visual Basic® for Applications (VBA) code or script that performs as expected and is reusable, easy to understand, and easy to maintain.
  • Writing Solid Script
    The benefits associated with writing reusable, understandable, and maintainable code can be realized whether you are writing script or Microsoft® Visual Basic® for Applications (VBA) code.
  • Using a Naming Convention
    There are many formal naming conventions and each has its adherents and detractors. You can adopt one of the existing conventions or create one of your own.
  • Structuring and Formatting Your Code
    How you use structured coding conventions directly affects how easy your code is to understand and maintain.
  • Commenting Code
    All procedures and functions should begin with a brief comment describing the functional characteristics of the procedure (what it does).