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! :)
 

Some videos you may like

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

Haluk

Rules Violation
Joined
Oct 26, 2002
Messages
1,075
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
 

tusharm

MrExcel MVP
Joined
May 28, 2002
Messages
11,028
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.
 

Bruno

Active Member
Joined
Feb 17, 2002
Messages
491

ADVERTISEMENT

Hi Damson,

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

Haluk

Rules Violation
Joined
Oct 26, 2002
Messages
1,075
Hi Bruno;

i guess that's not applicable for an animated *.gif That's why i've suggested using a WebBrowser object.
 

GeorgeB

Board Regular
Joined
Feb 16, 2002
Messages
239

ADVERTISEMENT

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?
 

Bruno

Active Member
Joined
Feb 17, 2002
Messages
491
Hi Raider,GeorgeB
Indeed an animated *.gif doesn't work properly :(
I have no experience with XL2000 and WebBrowser objects.
Sorry
 

Corticus

Well-known Member
Joined
Apr 30, 2002
Messages
1,579
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
 

Haluk

Rules Violation
Joined
Oct 26, 2002
Messages
1,075
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.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,962
Messages
5,599,065
Members
414,281
Latest member
Engjamal2021

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
Top