How to add an Icon to a commandBarButton
- From: "David"<david@xxxxxxxxxxxxx>
- Date: Wed, 29 Mar 2006 07:39:41 -0600
Hi,
I try To add an Icon(custom icon) to a commandBarButton.
I wrote the foloeing code in vba:
Dim myOlApp As New Outlook.Application
Dim objInsp As Outlook.Inspector
Dim objCBB As Office.CommandBarButton
Dim objCB As Office.CommandBar
Set myOlApp = CreateObject("Outlook.Application")
Set objInsp = myOlApp.ActiveInspector
Set objCB = objInsp.CommandBars("standard")
Set objCBB = objCB.Controls.Add(Type:=msoControlButton)
With objCBB
.Style = msoButtonIconAndCaption
.Caption = "MyAction"
.Visible = True
.Picture = stdole.LoadPicture("C:\Documents and Settings\MrkvLogo.ico")
.Mask = stdole.LoadPicture("C:\Documents and Settings\MrkvMask.ico")
End With
I get this error in ".Picture=..." and ".Mask=..." rows
Error message:
Run time error '5' :
Invalid procedure call or argument.
I use outlook 2003. However I need this code to work also with outlook 2000.
Thanks,
David
.
- Follow-Ups:
- Re: How to add an Icon to a commandBarButton
- From: Dmitry Streblechenko
- Re: How to add an Icon to a commandBarButton
- Prev by Date: RE: Run VBA Code from 'new mail message' on standard toolbar
- Next by Date: RE: Run VBA Code from 'new mail message' on standard toolbar
- Previous by thread: RE: Run VBA Code from 'new mail message' on standard toolbar
- Next by thread: Re: How to add an Icon to a commandBarButton
- Index(es):