Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2003

    Unanswered: Optional variables

    I'm declaring some variables in a Sub, and I wanted to do them in a specific order. However, I'm getting an error when I have a required variable between two Optionals.

    Sub ThisSub(Variable1, Variable2, Optional Variable3, Variable4, Optional Variable 5)

    "Compile Error: Expected: Optional"

    Do I have to declare all the required ones first and then all the Optionals?

  2. #2
    Join Date
    Nov 2003
    San Francisco, CA USA
    Why does the order that you're passing them matter to you?

  3. #3
    Join Date
    Nov 2003
    mageem provides a good question. Simply move Variable4 just ahead of Variable2:
    Private Sub ThisSub(Variable1, Variable2, Variable4, Optional Variable3, Optional Variable 5)
    or.....try this in your Call

    Call TheSub(Variable1, Variable2, , Variable4)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts