Incorrect Number of Event Arguments

I am getting the error: INCORRECT NUMBER OF EVENT PROCEDURE ARGUMENTS. This has been occuring ever since I created a control array of command buttons. I have to complete my project by tomorrow. Please Help!

I would guess that somewhere you have code in a Click event for one of those buttons. The quickest way to resolve this problem is this:

  1. Cut the code for the command buttons
  2. Highlight the entire event procedure, including the declaration and the End Sub, and delete it.
  3. Select the Command button array in the object list, and select the Click event.
  4. You’ll see that the parameters to the click now include the Index property, which was probably missing before.
  5. Paste in your code, making sure to remember that you have to check the index of the button to determine which button activated.
Also, the easiest way to keep track of which code goes to which button is to put all the various code in a Select Case statement. (e.g. Select Case Index). Comment heavily!

Share the Post:
Share on facebook
Share on twitter
Share on linkedin


Recent Articles: