"Invalid Procedure Call or Argument", but only in a compiled or P-Code EXE

Posted by Rob Perkins on Stack Overflow See other posts from Stack Overflow or by Rob Perkins
Published on 2010-04-03T20:48:42Z Indexed on 2010/04/03 20:53 UTC
Read the original article Hit count: 218

Filed under:
|
|

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.

© Stack Overflow or respective owner

Related posts about vb6

Related posts about runtime