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

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
 
K

Ken Slovak - [MVP - Outlook]

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.
Thread starter Similar threads Forum Replies Date
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 New Slipstick.com Articles 0
Diane Poremsky Assign an Email Account to an Outlook Contact New Slipstick.com Articles 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
T How to Assign Retention Tags for Notes Items in Exchange/Outlook 2010? Exchange Server Administration 0
L Can you use Exchange 2010 to control which users may or may not assign tasks to other users in Outlo Exchange Server Administration 2
N Assign Task from shared Task folder error Using Outlook 3
Q Don't have right permissions to assign "send as" rights in Exchange 2010 SP1 Exchange Server Administration 7
I Outlook 2010 Archiving Assign Policy Greyed out Using Outlook 1
C How do you assign a color to emails that are only colorized if received from a specific person? Using Outlook 2
F Any way to add emails to favourites or assign shortcuts to them? Using Outlook 5
M I have added an Assign Task button to a cutom group in the Tasks Ribbon. When I click on it I get a Using Outlook 3
P Can I Assign Outlook Tasks to a Public Folder? Using Outlook 1
P Can I Assign Put a Public Folder on a Tasks's Update List? Using Outlook 5
C Y i cannot assign service to the newly added EXCHANGE certificate? Exchange Server Administration 6
C How to assign certificate(s) to an CAS array? Exchange Server Administration 1
C how should i assign an SSL certificate to a CAS array? Exchange Server Administration 2
A Outlook 2010 - assign a color category to email Using Outlook 2
D Update List clears after sending to assign person. Using Outlook 1
D assign &amp; accept tasks using an IMAP email system Using Outlook 2
M Re: Exchange 2010 Resource forest - How do you assign permissions to share linked mailboxes? Exchange Server Administration 3
M Exchange 2010 Resource forest - How do you assign permissions to share linked mailboxes? Exchange Server Administration 7
D Assign rbac to specific group does not take affect. Exchange Server Administration 15
B Exchaneg 2010 SP1 Possible Bug, Cannot create move to archive retention tag on inbox, but can create a new one and edit and assign inbox to it Exchange Server Administration 3
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
T Outlook 2016 remove envelope icon for certain folders Using Outlook 6
M New icon? Using Outlook 4
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
Similar threads


















































Top