Home button

sts023

Board Regular
Joined
Sep 1, 2008
Messages
106
I'd like to use a Home button image on a button in a spreadsheet (Office 2010).
I think I can do it using the FileName operand of the OLEObjects.Add method, but I'm struggling to find an example of how to do so.
I had originally mis-remembered that there was an image of a house in the imageres.dll file, so I was going to try to use that, assuming that I could use code like
Code:
Sub samplecode()
Dim objButton As OLEObject
Dim lngIdx, lngL, lngT, lngW, lngH
'
' Code to set relevant variables
' removed for brevity
'
  With ActiveSheet.OLEObjects
    Set objButton = .Add( _
      DisplayAsIcon:=True, _
      iconFilename:="%SystemRoot%\system32\SHELL32.dll", _
      iconindex:=lngIdx, _
      Link:=False, _
      Left:=lngL, _
      Top:=lngT, _
      Width:=lngW, _
      Height:=lngH)
  End With
End Sub
Although this compiles, I'm not sure it would execute!

And in any case, there doesn't seem to be a "House" button in that dll (although there are others I could use).

Does anyone know where I can see some sample code which uses this method to create a button?

All help gratefully received....
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
there are lots of houses in clipart, which maybe easier to work with ?
 
Upvote 0

Forum statistics

Threads
1,215,375
Messages
6,124,591
Members
449,174
Latest member
chandan4057

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