Click to See Complete Forum and Search --> : Picture print?


Victor
November 9th, 1998, 07:29 AM
I want to print a gif/jpg file,so i use the "PrintPicture" method.


Printer.PaintPicture Picture1.Picture, Picture1.Left, Picture1.Top, _

Picture1.Width, Picture1.Height, vbMergeCopy


But when the programe runs,the system reports run-time error 5.

What's the error mean?


Thanks.

Crazy D
November 11th, 1998, 02:14 AM
Error 5 = Invalid procedure call or argument

You can easily check that yourself when the error occurs, go into breakmode and use the debug window (immediate window): ? err.description

It means that you call a function/method which uses more arguments than you pass. In this case, this is the function declaration:


object.PaintPicture picture, x1, y1, width1, height1, x2, y2, width2, height2, opcode

As you see, it has more arguments then you're call to the function. You probably misunderstoord the part in the help which says optional;. It means that you don't have to enter values for that, but, if there are more arguments, you need to enter a few comma's, thus I think this should work:


Printer.PaintPicture Picture1.Picture, Picture1.Left, Picture1.Top, _

Picture1.Width, Picture1.Height, , , , , vbMergeCopy


Note: if an optional argument is the last argument in a function call, you can simply ignore it. In this case, it isn't, so use empty values (see above)

Hope it helps!