View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
RC- RC- is offline
external usenet poster
 
Posts: 12
Default Commandbutton picture problem

Jim,
Is there a particular reason why you want to load your own picture, i.e.
does the corporate office force you to use a certain icon? If not, check
this utility out, I have been using it for about three years now and I swear
by it.

http://skp.mvps.org/faceid.htm

Once you load the add-in, all you have to do is browse for an icon that you
like and plug in the number into the .FaceID property of your menu bar

Example:

With cbtDA
.Style = msoButtonIconAndCaption
.TooltipText = "Listing of available reports."
.Caption = "Reports"
.Visible = True
.Picture = picPicture YOU WOULD REMOVE THIS ENTRY AND REPLACE
WITH THE ONE BELOW
.FaceID = 2487 THE NUMBER WOULD BE THE NUMBER THAT IS
ASSOCIATED WITH THE ICON YOU LIKE
End With


Sorry for the caps above, just wanted to make sure you saw the instructions

I hope this helps
RC-


"Jim B" wrote in message
...
Hi,

I'm trying to set the picture of a commandbutton with VBA code in Excel
and
I get an automation error:

-2147467259 (80004005)

Here's the code I'm using:

Dim cbDA As CommandBar
Dim cbtDA As CommandBarButton
Dim picPicture As IPictureDisp
Dim picMask As IPictureDisp

Set cbDA = Application.CommandBars("Data Analysis")

Set cbtDA = cbDA.Controls.Add(msoControlButton)
Set picPicture = stdole.StdFunctions.LoadPicture( _
"c:\corp_dev\Icon_Lib\eWorld 2000 Win\globe.ico")
With cbtDA
.Style = msoButtonIconAndCaption
.TooltipText = "Listing of available reports."
.Caption = "Reports"
.Visible = True
.Picture = picPicture
End With

I made sure the globe.ico file was correctly referenced and that stdole
was
available. I even tried testing it with a common bmp file used by office
and it still failed.

What am I doing wrong?

Thanks,

--
Jim Bourque