"Invalid Procedure Call or Argument", but only in a compiled or P-Code EXE
- by Rob Perkins
I have a VB6 program which I've been maintaining for ten years. There is a subroutine in the program called "Prepare Copy", which looks like this:
Public Sub PrepareCopy()
Set CopiedShapes = New Collection
End Sub
Where CopiedShapes is dimmed out as a VB6 Collection.
That code is now kicking out a Runtime Error 5 -- Invalid Procedure Call or Argument. It appears from the interstitial debugging code that the error arises between the Public Sub PrepareCopy() and the Set CopiedShapes = New Collection lines.
That's right. The VB6 error is happening between two lines of my code. I can think of no other explanation for this. It's behaving this way on my development machine and two client computers.
It is only happening in runtime code, and does not appear to make a difference whether I compile it or use P-Code
What I'm asking for here is speculation as to what causes this sort of thing to happen.