Setting A Command Bar Button Picture - Catastrophic Failure Error

  • Thread starter Thread starter Whatever
  • Start date Start date
W

Whatever

Hi,

I've developed a COM addin for Outllook (using VB6) which places a new
command bar button into the Standard toolbar. The button is created
for each inspector window at the point it is opened. The button needs
to have both an icon and text but I'm having trouble setting the icon.

Sample code executed when the inspector loads:

---------------------------------------------------------------------------------------------------------------
Set moButton =
moInspector.CommandBars.Item("Standard").Controls.Add(msoControlButton,
, , , True)

moButton.Caption = BUTTON_CAPTION_EMAIL
moButton.ToolTipText = BUTTON_TOOLTIP_EMAIL
moButton.Style = msoButtonIconAndCaption
moButton.Picture = VB.LoadResPicture(101, 0)
----------------------------------------------------------------------------------------------------------------

The last line of code fails and Outlook raises the following error:

-2147418113 - Catastrophic failure

The button displays and functions OK but without the intended icon.

Interestingly the same error occurs if I try to read the Picture
property into an object variable also. It seems any attempt to access
this property (read or write) causes the error.

Any ideas greatly appreciated.

Thanks
Paul.
 
Back
Top