PDA

View Full Version : zodiac userform to display zodiac sign picture based on users birthdate



RoadDog83
10-22-2009, 10:17 AM
so im taking a vba class at the community college here and we have an asignment to make a userform that the user inputs there name and then selects there birthdate from a calendar control and when they click the button it says " name, you were born under the sign of the blank" and it should also display the correct zodiac sign picture. problem is i have no idea how to get pictures to display based on a particular result. can anybody clue me in as to how to do this? maybe post an example of a similar document? i dont expect anybody to give me the answer i just dont know where to start as far as the picture things goes. thanks for any help.

Bob Phillips
10-22-2009, 10:28 AM
Load all of the pictures on a worksheet and set ther Visible property to False. Put them all in the same position, where you want them to show.

Make sure they are all properly name.

When a date is selected, determine the sign, then make that picture visible and make all others not visible (to hide the previous).

RoadDog83
10-22-2009, 10:35 AM
i believe the teacher wants this image to appear on the user form. nothing actually happens on a spreadsheet itself. is what you suggested still applicable?

Bob Phillips
10-22-2009, 10:59 AM
Oh no, getting a picture on a userform is a lot harder.

But it is possible, see http://www.oaltd.co.uk/Excel/Default.htm and scrfoll down to PastePicture.zip.

mdmackillop
10-23-2009, 12:14 AM
To get a picture on a form try
Image1.Picture = LoadPicture("C:\AAA\test.jpg")

Also, try searching the site for LoadPicture.

Dodgeitorels
10-24-2009, 05:30 PM
I came up with this solution for me, may work for you http://www.vbaexpress.com/forum/showthread.php?t=28238&highlight=userform+to+input+data

Of course most of the solution was due to help from mdmackillop