Solved

Custom icon for a macro in Outlook 2010

Posted on 2014-02-16
7
2,208 Views
Last Modified: 2014-03-27
I've created various macros in Outlook 2010 using VBA.

I've added the ability to execute these macros from the Ribbon by customising the Ribbon to add a new tab, new group and finally new buttons that execute the macros.

Outlook's built-in icons are ok, but I would prefer to use custom-made icons, perhaps created using some other icon graphics program.

Does anyone know of a straightforward way to do this? I'm a java developer so I'm not too familiar with Microsoft's inner workings.

Many thanks for any help.
0
Comment
Question by:amrshalaby
  • 4
  • 3
7 Comments
 
LVL 19

Expert Comment

by:regmigrant
ID: 39862526
The basic principle is to load the custom image using xml:-
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui"
  loadImage="GetImage">
<!-- other stuff -->
   <button id="mycode" image="myimg.jpg" />

However the size, type, grouping, callbacks, etc may vary according to how your current customisations are constructed - especially if you are using Com Addins.

Microsoft has a series of developer resources here:-
http://msdn.microsoft.com/en-us/library/aa338202.aspx

and there's an open source UI editing tool at
http://openxmldeveloper.org/blog/b/openxmldeveloper/archive/2009/08/07/7293.aspx
0
 

Author Comment

by:amrshalaby
ID: 39879123
Thank you regmigrant. Sorry about the delay getting back to you.

Would you be able to provide a step by step process to get this to work? I would investigate the links you've provided however I've got a baby on the way and am a bit time-poor.
0
 
LVL 19

Expert Comment

by:regmigrant
ID: 39879230
Been there and understand the problem but without knowing what you are trying to achieve and how what you've already done there's really not a lot more I can add other then the XML strings above, The MS develop guide discusses how those strings work and the UI editing tool would need your code loaded to allow any changes.
0
Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

 

Author Comment

by:amrshalaby
ID: 39879260
Apologies regmigrant, my bad. I'm a java programmer so microsoft is a bit alien to me (besides a few VBA macros painfully put together).

This isn't an add-in. It's a macro put together by going into Outlook 2010's Developer tab and typing in some VBA code into a stored procedure.

If you then right-click on the Ribbon and select "Customise Ribbon", that allows you add a custom button to the Ribbon (perhaps in a new tab and new group) so that you can call this macro. However you are limited as to the icons you can use - basically the internal stock icons.

My question was whether Microsoft Outlook 2010 allows you to customise the Ribbon further by either:

1. Importing a new icon into their stock collection. In that case you can pick that new icon when customising the Ribbon to add to that new button that calls your macro.
2. Importing a new icon in some other way, and assigning it to the new button.
0
 
LVL 19

Expert Comment

by:regmigrant
ID: 39879379
This is not available from the Office UI - You can only choose from the built in images by design (MS wanted to maintain a consistent user experience).

However you can add custom images to the list or use images from disk - the simplest way to do this is to download a custom UI editor as linked above.

the way it works (simplified):-

Non-binary Excel files are stored as Zip archives and named XLM, XLS  etc. To modify the ribbon you open one of these archives and put your changes into xml stream you will find there called customUI. You can add your own pictures from disk or add them into the file itself - which makes it easier to keep your customisations. To make it work you also need VBA code to process the custom image - (this element is handled for you with the internal images).

Rather than try and coach you - its not complicated but its very easy to screw up if you aren't a XML expert (which definitely includes me) - I will point you at a web site that has example code and explanations.
http://www.rondebruin.nl/win/s2/win009.htm

Download the examples and see how they are manipulating the custom images in three different ways, they recommend the Custom UI route but also cover the modification of the XLSM 'archive'  and include all the code necessary to make it work.

Remember that to view what they are doing you most open the XLSM file with an archive program (I use 7zip) and it will reveal the internal structure mentioned in the article

Outlook is more complicated because it doesn't have the archive container so and add-in or the use of Visual Studio is needed to achieve the same goal.
0
 

Author Comment

by:amrshalaby
ID: 39915716
Thank you regmigrant, that's a nice and easy explanation on your part of how you can add custom icons to Excel and very informative.

It does appear that adding custom images to Excel is relatively straightforward (or not, depending on your views!) but in any case definitely doable by following your instructions above.

As Outlook doesn't have an archive container like Excel, you mentioned that either "an add-in or the use of Visual Studio is needed to achieve the same goal".

I take it then that what I'm trying to do is impossible unless I use Visual Studio?
0
 
LVL 19

Accepted Solution

by:
regmigrant earned 500 total points
ID: 39915801
I wouldn't like to say its impossible - there are people on here who have achieved things even MS didn't think of - but when doing my own investigation for a different project everyone pointed my at the available office customisation suites and Visual Studio (free) - apart from another learning curve.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Resolve Outlook connectivity issues after moving mailbox to new Exchange 2016 server
Outlook Free & Paid Tools
This video shows where to find the word count, how to display it, and what it breaks down to in Microsoft Word.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now