Help : Code for inserting a photo in a userform?

V

vicenflor

With a command button in a userform, I want to select a picture and display
it at the left side of this command button. The selection of the picture by
clicking on the commandbutton works fine but I can't get the picture to be
displayed in the image button. Which code should I use? I tried the following
code :

"Set UserForm1.Photo1.Picture = strFile "

(strfile is the complete path of the picture and is defined as a string )

What is wrong? Can somebody help?Thanks
 
J

Jay Freedman

With a command button in a userform, I want to select a picture and display
it at the left side of this command button. The selection of the picture by
clicking on the commandbutton works fine but I can't get the picture to be
displayed in the image button. Which code should I use? I tried the following
code :

"Set UserForm1.Photo1.Picture = strFile "

(strfile is the complete path of the picture and is defined as a string )

What is wrong? Can somebody help?Thanks

You need this syntax (which is given in the Help topic on the Picture
property):

UserForm1.Photo1.Picture = LoadPicture(strFile)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top