Creating a COM Addin

G

Greg Maxey

I don't know if I am posting in the right place or not. I downloaded
the Word2007 Beta2 on Friday and have spent much of the past weekend
frustrated over how difficult MS has made it for a user to make simple
customizations to the UI. At first I thought that it simply wasn't
possible but to my relief I have stumbled upon several MSDN articles
that claims it can be done and done easily. After reading these
articles i have no doubt that the ribbon UI can be customized, the easy
part remains to be seen.

It does appear that a user can not make customizations to the ribbons
simply by exploring and using the available commands. To do so, you
have to become a "developer" of some degree of skill. For the present
I need to learn enough developer skill to make simple customizations.
For example, I would like to create my own tab and then be able to
assign buttons to that tab that will fire macros. This would be
similiar to creating a toolbar and assigning macros to buttons on the
toolbar earlier Word versions.

I read in one of the articles that in order to apply Ribbon UI
customizations application wide they need to be created as a COM Addin
and that these add-ins could be created using VBA.

First question: Can anyone provide guidance for creating a COM Add-in?

The other part of the process is developing XML code that actually does
the customization. The documentation indicated that this XML code
could reside in an exterally XML file or withing the Add-in itself.

It appears that making customization is only going to be easy if you
know a little bit more than absolutely nothing about XML (my case).
However, applying to concept monkey see, monkey do, I think that I
could gain enough proficiency to get by if I could only see enough to
get started.

My objective is to see how an COM Add-in is coded, loaded, applied,
etc. that then applies XML (either in the Add-in or from an external
file {actually both ways would be most helpful}) to customize the
Ribbon. Just a simple example to add a custom tab, with a button, that
calls a macro.

If there is a better place to post this question then please advise.
 
J

Jonathan West

Greg Maxey said:
I don't know if I am posting in the right place or not. I downloaded
the Word2007 Beta2 on Friday and have spent much of the past weekend
frustrated over how difficult MS has made it for a user to make simple
customizations to the UI.

As I understand it, this has been a deliberate policy on the part of
Microsoft. With the new UI, yoiu can drag a few buttons to the Quick Launch
Toolbar, and that is about the limit of it wothout getting into developer
tools.
At first I thought that it simply wasn't
possible but to my relief I have stumbled upon several MSDN articles
that claims it can be done and done easily.

It can, and quite easily - provide you are a developer and familiar with
developer tools and techniques. "Easily" in the context of an MSDN article
means "in a way that can be automated by code".
After reading these
articles i have no doubt that the ribbon UI can be customized, the easy
part remains to be seen.

It's all about context :)
It does appear that a user can not make customizations to the ribbons
simply by exploring and using the available commands. To do so, you
have to become a "developer" of some degree of skill. For the present
I need to learn enough developer skill to make simple customizations.

In that case, you are limited to the QLT for the time being.
For example, I would like to create my own tab and then be able to
assign buttons to that tab that will fire macros. This would be
similiar to creating a toolbar and assigning macros to buttons on the
toolbar earlier Word versions.


Nope, that requires code.

I read in one of the articles that in order to apply Ribbon UI
customizations application wide they need to be created as a COM Addin
and that these add-ins could be created using VBA.

If it can be done using VBA (And I understand that it can) then it doesn't
require a COM add-in. It can be done from any VBA macro that issues the
necessary commands.
First question: Can anyone provide guidance for creating a COM Add-in?

Forget about this. I strongly suspect that a COM add-in is more trouble than
it is worth. Just use VBA in a template that is stored in an ordinary add-in
in the Startup folder.
The other part of the process is developing XML code that actually does
the customization. The documentation indicated that this XML code
could reside in an exterally XML file or withing the Add-in itself.

As I understand it, either of these is possible, and a third possibility is
that the XML code string is generated on the fly by the VBA code. All that
is required is that an appropriate XML string is passed to the necessary
object.
It appears that making customization is only going to be easy if you
know a little bit more than absolutely nothing about XML (my case).
However, applying to concept monkey see, monkey do, I think that I
could gain enough proficiency to get by if I could only see enough to
get started.

My objective is to see how an COM Add-in is coded, loaded, applied,
etc. that then applies XML (either in the Add-in or from an external
file {actually both ways would be most helpful}) to customize the
Ribbon. Just a simple example to add a custom tab, with a button, that
calls a macro.

If there is a better place to post this question then please advise.

This is probably as good a place as any to ask, but the number of people who
have had the opportunity to play is provbably still limited. I've only spent
an hour or so on Beta 2 so far, and that was primarily dedicated to testing
my existing code and templates for compatibility. I've seen demos of
Microsoft people doing ribbon customisation using code,
enough to know the general principles and have a decent idea where to look
when I get round to it, but I've not had the time yet to actually experiment
for myself yet.


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
 
G

Greg Maxey

Jonathan,

Thanks for your reply. It is good to know that just a regular template
loaded as an Add-in at Start Up should be able to trigger the
customization.

It seems the path of least resistance would be something like:

Learn where (which program) and how to write the XML code. I suppose
that there is some application out there that provides something
similiar to VBA intellisense for developing the XML.

Save the XML file somewhere

Create the Global Add-in with code that points to the XML file

Put the Add-in in Start Up.

I will keeping stumbling around and try to find a way to connect the
dots and in the mean time hope someone gives me the fish ;-).
 
D

Doug Robbins - Word MVP

Hi Greg,

A template add-in that I use that created in previous versions of Word a
number of custom toolbars that were located on either side of the window,
results in Word 2007 with all of the buttons on those toolbars being located
under a section called Custom Toolbars under the Add-Ins tab.

I guess the Add-Ins tab may only appear if there are add-ins to be loaded.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
G

Greg Maxey

Doug,

Yes I have noticed that as well when I add some of my Word2003
templates as Add-in to Word2007. That begins to look clunky really
fast if you have several add-in loaded or if the toolbars in the addin
have lots of commands.

It also isn't a good solution when I want to create a new add-in in
Office2007 that has macros. For me the Word2003 method was add a
custom toolbar with the macros as command buttons so in Word2007 I want
to be able to add a custom tab with the macros fired from command
buttons on the tab.

There is a procedure for creating RibbonUI customization (with
examples) in the MSDN Article "Customizing the Office (2007) Ribbon UI
for Developers Part 1 of 2." I have working through it over a dozen
time performing each step to the best of my knowledge and the result is
always a corrupted document that Word won't open.

I found a blog a little while ago http://pschmid.net/blog/2006/05/24
where a savvy computer sciences Phd is working on an Addin for
customizing the ribbon and said he plans to post a VBA solution as
well. From the the looks of his work so far, he certainly appears to
know what he is talking about. I am waiting with baited breath for the
keys to the kingdom ;-)

Thanks for your post Doug and if you try that method in the article
mentioned and work your way through it, please let me know.
 

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