View Single Post
  #1  
Old March 29th 06, 02:39 PM posted to microsoft.public.outlook.program_vba
David
external usenet poster
 
Posts: 4
Default How to add an Icon to a commandBarButton

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
Ads
 

Home Loans in India - Pay Day Loans - Ringtones - Repair Bad Credit - Advertising