Input Box with picture


Posted by Sam on July 23, 2001 7:19 AM

I was wondering if there was any way to attach an image to an inputbox. All I need is the user to type in a simple three digit number based on the picture to the right. I was dabbling with a few user forms but i can't seem to get those to work either. I was using a text box for the input. Is that what I need to use or something else?

Thanks,
Sam



Posted by Mark Rutherford on July 26, 2001 9:14 AM

I'd say the dialog sheets method would work fine as I've done this before. It's a bit tiresome transferring the answers to the spreadsheet but isn't difficult.

I'm using Excel 7 so you might have to interpret some of my waxings if you're using later versions.

Create a user form - copy the picture from paint, internet, wherever and right-click(paste) it onto the form. Add an EditBox to the form and make a note of the Form name (something like "EditBox 3")

Now you need three things.

1) A way to trigger the form. You could for example attach the following macro to a button.

Sub Show_that_box()
Dialogsheets("Dialog 1").Show
End Sub

2) A user who types in their response to the picture. This string is now contained in the .Text property of EditBox 3.

3) A way of transferring the text to a spreadsheet for example. So... attach a second macro to the OK button on the Dialogbox (user forms in 97?) such as:

sub When_you_click_OK()
user_typed_this=EditBoxes("EditBox 3").text
Sheets("Target").select
Range("a3").Value=user_typed_this
end sub

Clear as mud, no doubt.
Good luck.