ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   LoadPicture into UserForm (https://www.excelbanter.com/excel-programming/447763-loadpicture-into-userform.html)

Charlotte E.[_3_]

LoadPicture into UserForm
 
Hi,

I have a UserForm, in which I need to import some images from time to time.

Currently I'm using:

Image_3_A.Picture = LoadPicture(Path & Picture)

....which is working fine :-)

But I always need to perform some actions before showing the image, so I
figured, I'll do my own UDF, which both does all the action, and as the
last line in the UDF prase the path and picture to the function.

I did the function, called MyLoadPicture, which works fine until the
very last line:

MyLoadPicture = LoadPicture(Path & Picture)

This very last line gives an 'Object required' error!?!

I think it as to do with IPictureDisp object, but how to make it work???

I was kind of hoping to be able to use my function like the normal
'LoadPicture' function, i.e.:

Image_3_A.Picture = MyLoadPicture(Path & Picture)

Thanks in advance,

CE

RB Smissaert[_2_]

LoadPicture into UserForm
 
You need to post the code of the procedure MyLoadPicture.

RBS


"Charlotte E." wrote in message
...
Hi,

I have a UserForm, in which I need to import some images from time to
time.

Currently I'm using:

Image_3_A.Picture = LoadPicture(Path & Picture)

...which is working fine :-)

But I always need to perform some actions before showing the image, so I
figured, I'll do my own UDF, which both does all the action, and as the
last line in the UDF prase the path and picture to the function.

I did the function, called MyLoadPicture, which works fine until the very
last line:

MyLoadPicture = LoadPicture(Path & Picture)

This very last line gives an 'Object required' error!?!

I think it as to do with IPictureDisp object, but how to make it work???

I was kind of hoping to be able to use my function like the normal
'LoadPicture' function, i.e.:

Image_3_A.Picture = MyLoadPicture(Path & Picture)

Thanks in advance,

CE



Charlotte E.[_3_]

LoadPicture into UserForm
 
Stupid me!

Got it!

I forgot to set the object variable...

Sometimes you just can't see the forrest for all them trees :-)

Sorry..


CE



Den 01.12.2012 11:48, Charlotte E. skrev:
Hi,

I have a UserForm, in which I need to import some images from time to time.

Currently I'm using:

Image_3_A.Picture = LoadPicture(Path & Picture)

...which is working fine :-)

But I always need to perform some actions before showing the image, so I
figured, I'll do my own UDF, which both does all the action, and as the
last line in the UDF prase the path and picture to the function.

I did the function, called MyLoadPicture, which works fine until the
very last line:

MyLoadPicture = LoadPicture(Path & Picture)

This very last line gives an 'Object required' error!?!

I think it as to do with IPictureDisp object, but how to make it work???

I was kind of hoping to be able to use my function like the normal
'LoadPicture' function, i.e.:

Image_3_A.Picture = MyLoadPicture(Path & Picture)

Thanks in advance,

CE



All times are GMT +1. The time now is 11:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com