Create a custom Sub procedure

Create a custom Sub procedure

  1. Open a new module.
  2. Declare the procedure by typing the Sub statement.

  3. Type a procedure name, immediately followed by any arguments in parentheses. For example, the following declaration for the ShowEvent Sub procedure specifies (EventName As String) as an argument:
    Sub ShowEvent(EventName As String)

  4. Add the Visual Basic code that performs the operation that you want the procedure to perform.

For more information on the Sub statement, click .