J
Jim B
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,
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,