Setting A Command Bar Button Picture - Catastrophic Failure Error

P

pswfps

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.
 
K

Ken Slovak - [MVP - Outlook]

Don't multipost. See my answer in another group you posted in.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top