How to assign icon to a button in Outlook Add-in

  • Thread starter Thread starter cGFyZXNo
  • Start date Start date
Status
Not open for further replies.
C

cGFyZXNo

Hi,

I have wrtten Outlook COM Add-in. The attached code on startup creates the

button on outlook tool bar and assign the icon C:\local\cat.bmp. Could anyone

please tell me how could I make my Add-in independent of C:\local\cat.bmp? I

mean can I put picture somewhere in add-in itself so that while installing on

other machine it should have any problem if C:\local\cat.bmp is not there. OR

How could I use any system icon?

Set moCBMeow =

moApp.ActiveExplorer.CommandBars.Item("Standard").FindControl(, , "890",

False, True)

If TypeName(moCBMeow) = "Nothing" Then

Set moCBMeow =

moApp.ActiveExplorer.CommandBars.Item("Standard").Controls.Add(msoControlButton, , "890", , True)

End If

With moCBMeow

> BeginGroup = True

> Caption = "Copylink"

> DescriptionText = "Meow meow meow"

> Enabled = True

> OnAction = "!<CopyLinkTestingAddin.Connect>"

Clipboard.Clear

Clipboard.SetData LoadPicture("c:\local\cat.bmp")

> PasteFace

> Style = msoButtonIconAndCaption

> Tag = "890"

> ToolTipText = "Meow meow meow"

> Visible = True

End With

Thanks.

Paresh
 
Any image supplied for a CommandBarButton object must be 16x16x256 colors.

If put on the clipboard it must be a BMP, if you use Picture/Mask you supply

an IPictureDisp object.

To re-use an Outlook button image you get the CommandBarButton with the

image you want and use CopyFace to put it on the clipboard for PasteFace to

grab.

For any other image you can put it in the resource file for your addin

project and grab it from there, using whatever method is available in the

language you are using for loading image resources.

"paresh" <paresh> wrote in message

news:919B4392-FA0F-4123-AE65-112DF77D377B@microsoft.com...
> Hi,

> I have wrtten Outlook COM Add-in. The attached code on startup creates the
> button on outlook tool bar and assign the icon C:\local\cat.bmp. Could
> anyone
> please tell me how could I make my Add-in independent of C:\local\cat.bmp?
> I
> mean can I put picture somewhere in add-in itself so that while installing
> on
> other machine it should have any problem if C:\local\cat.bmp is not there.
> OR
> How could I use any system icon?

> Set moCBMeow =
> moApp.ActiveExplorer.CommandBars.Item("Standard").FindControl(, , "890",
> False, True)
> If TypeName(moCBMeow) = "Nothing" Then
> Set moCBMeow =
> moApp.ActiveExplorer.CommandBars.Item("Standard").Controls.Add(msoControlButton,
> , "890", , True)
> End If
> With moCBMeow
> .BeginGroup = True
> .Caption = "Copylink"
> .DescriptionText = "Meow meow meow"
> .Enabled = True
> .OnAction = "!<CopyLinkTestingAddin.Connect>"
> Clipboard.Clear
> Clipboard.SetData LoadPicture("c:\local\cat.bmp")
> .PasteFace
> .Style = msoButtonIconAndCaption
> .Tag = "890"
> .ToolTipText = "Meow meow meow"
> .Visible = True
> End With

> Thanks.
> Paresh
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
Z Outlook 365 Automatically assign categories to incoming mail in a shared folder Round Robin Outlook VBA and Custom Forms 1
R Auto Assign Category colours to Incoming Emails based on whom the email is addressed Outlook VBA and Custom Forms 3
R Assign Categories "Round Robin" style but in a shared mailbox but on specific emails only Outlook VBA and Custom Forms 8
P Auto assign shared mailbox Outlook VBA and Custom Forms 1
D Assign categories to outgoing emails Outlook VBA and Custom Forms 0
F How to assign a task to a public task folder? Using Outlook 1
A How to assign the value returned by the regex execute function to a variable? Using Outlook 1
soadfan assign category (VBA) Using Outlook 7
Diane Poremsky Assign one task to several people Using Outlook 0
Diane Poremsky Assign an Email Account to an Outlook Contact Using Outlook 0
E for Mac: Assign Task not available!? Using Outlook 1
E Outlook VBA to print attached Pdf to a fax printer and assign fax number Using Outlook 0
A Assign a unique number to every message I send Using Outlook 0
Z assign unique number email Using Outlook 8
J Assign a signature by external or internal reciepents. Outlook VBA and Custom Forms 1
P VBA to assign category on calendar item does not work ?? why ?? Outlook VBA and Custom Forms 5
S assign task programmatically Outlook VBA and Custom Forms 2
C Cannot assign a task from a public folder? Outlook VBA and Custom Forms 4
C Assign To and CC list while using Redemption.dll library Outlook VBA and Custom Forms 10
X Custom icon (not from Office 365) for a macro in Outlook Outlook VBA and Custom Forms 1
S Paperclip icon shows without attachment in email under Sent folder Using Outlook 0
J Text icon in Quick Access toolbar ? Using Outlook 2
T Outlook 2016 remove envelope icon for certain folders Using Outlook 5
M New icon? Using Outlook 3
W Get a "New Note" icon onto the QAT Using Outlook 3
Commodore Attachment icon when there is no attachment Using Outlook 3
J Control Panel Mail (settings) icon missing Using Outlook 2
J Problem with Outlook 2016 new mail tray icon alert (envelope in the systems tray) Using Outlook.com accounts in Outlook 0
G Outlook 2016: reply icon not showing when replied from mobile Using Outlook 3
E What does mean this icon at the picture attached? Using Outlook 2
W "Post" icon on some contacts Using Outlook 1
P Delete Icon Using Outlook 2
Witzker Change icon for custom views Using Outlook 1
D Email Icon Column Using Outlook 2
M Recurring icon for custom form task item Outlook VBA and Custom Forms 6
A Change Outlook Taskbar Icon Using Outlook 0
P IM and Phone icon is Grayed out in Outlook 2013 - Using Lync 2013 Using Outlook 4
wisedave Missing icon that show message was forwarded, etc Using Outlook 1
F Custom contact form icon issue Using Outlook 1
M Floating Delete Icon in mail list Using Outlook 1
V Reply Arrow Icon appears when both Replying or Forwarding Using Outlook 3
T Add 'Move to folder' icon to custom form Using Outlook 1
J phone icon greyed out in outlook 2013 Using Outlook 1
H how to change the Folder icon in Contact Using Outlook 7
P Outlook closes down after clicking on the quick print icon. Using Outlook 3
M Remove sharing icon from outlook contacts Using Outlook 6
A No profiles created problem in outlook after clicking outlook icon Using Outlook 0
D How do I get a new mail icon into my quick launch bar? Using Outlook 3
D How do I run a rule by using a toolbar icon? Outlook VBA and Custom Forms 4
M How to resize the instant search pane on click on the icon to expand/ Outlook VBA and Custom Forms 1

Similar threads

Back
Top