Can I use gif images for buttons in user forms?

Damson

New Member
Joined
Nov 6, 2002
Messages
5
I need to create a user form for some young children to enter data. I'd like to use gif images as input buttons. Can this be done?

Possibly a bit ambitious as I've done next to nothing with Excel before - but if anyone can help with how to do this I'd be very grateful! :)
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Hi;

i don't know how to deal with the commandbutton object but, if you need to place an animated *.gif picture (which is located in your PC with a known file path) on the UserForm, you can add a WebBrowser object to your UserForm and paste the below lines to the VBA part of the UserForm;

Private Sub UserForm_Initialize()
WebBrowser1.Navigate ("C:sample.gif")
End Sub
 
Upvote 0
A quick design-time technique that applies to the userform and to a control is as follows.

Copy a picture to the clipboard (with a browser or any image viewing program).

In XL VBE, in design mode, click on the userform (or the control). Open the Properties window (F4 or right-click | Properties or View | Properties Window). Click in the Picture property field. Paste with CTRL-V.

You can also select any picture on your computer by clicking the browse button that shows up after clicking in the Picture property field.
 
Upvote 0
Hi Damson,

Put a normal command button on your userform,
press F4, select Picture and select the picture you want to use...
 
Upvote 0
Hi Bruno;

i guess that's not applicable for an animated *.gif That's why i've suggested using a WebBrowser object.
 
Upvote 0
Bruno
Tried that and the pict shows fine at design time but the button comes up black when loaded. Using a jpeg image. Any ideas why?
 
Upvote 0
Hi Raider,GeorgeB
Indeed an animated *.gif doesn't work properly :(
I have no experience with XL2000 and WebBrowser objects.
Sorry
 
Upvote 0
This is soos cool!

I got Raider's WebBrowser method to work like a champ, with action:

Tools|Additional Controls|check Microsoft Web Browser

use:
Code:
Private Sub UserForm_Initialize()

WebBrowser1.Navigate ("C:AnyImage.gif")

End Sub

then to capture click and execute action:
Code:
Private Sub WebBrowser1_Enter()
MsgBox ("Success")
End Sub

of course, you could substitute the MsgBox for whatever....

Good stuff!

HTH,
Corticus
 
Upvote 0
Hi Bruno;

All you need is, on an empty area of the tool box, right click the mouse and select "Additional Controls" from the pop-up menu. Then, from the "additional Controls" window, select "Microsoft web Browser" and close the windows. You will see that, the new control "WebBrowser" has been added to the tool box, which you can use it like the other ordinary controls.
 
Upvote 0

Forum statistics

Threads
1,213,490
Messages
6,113,956
Members
448,535
Latest member
alrossman

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top