ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Programmatically put an image on a button (https://www.excelbanter.com/excel-programming/370448-programmatically-put-image-button.html)

quartz[_2_]

Programmatically put an image on a button
 
I am using Office 2003 on Win XP.

I have coded a program that adds an ActiveX button (OLEObject) on a
spreadsheet. Now I want to place an image on the surface of the button, which
I can do manually, but the macro recorder doesn't pick up the keystrokes.

Can someone please provide some example code that adds an image?

Thanks much in advance.

Tom Ogilvy

Programmatically put an image on a button
 
Sub abc()
s = "C:\Documents and Settings\" & _
"OgilvyTW\My Documents\My Pictures\sample.jpg"
ActiveSheet.CommandButton1.Picture = LoadPicture(s)
End Sub

--
Regards,
Tom Ogilvy


"quartz" wrote:

I am using Office 2003 on Win XP.

I have coded a program that adds an ActiveX button (OLEObject) on a
spreadsheet. Now I want to place an image on the surface of the button, which
I can do manually, but the macro recorder doesn't pick up the keystrokes.

Can someone please provide some example code that adds an image?

Thanks much in advance.



All times are GMT +1. The time now is 01:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com