Link to home
Start Free TrialLog in
Avatar of xav056
xav056

asked on

VB.Net word ribbon customization in an app

I am working on an application that will work with a word application .
So in my vb code a create an new word applicaton and I load a document into it,
Under the solution I have another project whic is word 2007 addin, where I customize the Ribbon.xml file to disable somw word menues and add some tabs.
The problem is as soon as I compile the application , if I launch an independent instance of word from the program files, the word would have all my customization for the ribbon.
How do I keep the customization local to my solution; i.e only the word laucned by my application to be customized and ant word launched manually to have a default template

what is document level customization project? It seems that the word 2007 addin is an application level customization.

There is some suggestions here
http://stackoverflow.com/questions/294859/ribbon-instances-per-document but hwat kind of project to I need to create?

Thank you
Avatar of xav056
xav056

ASKER


If I am doing it wrong what type oif project do I create
word 2007 document , word 2007 template or word 2007 addin.
Again what I am looking for is to be able to open a document from my windows form with a ribbon

ASKER CERTIFIED SOLUTION
Avatar of Miguel Oz
Miguel Oz
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of xav056

ASKER

Hello mas_oz2003:
I already took that path (using a word 2007 template), however I am not sure how to load this template to an existing document
So if I had a docx saved somewhere I would like to have the custom ribbon applied to this docs, is there a way that I would force the docx to open in the dotx, again all i need is the frame(UI) of the dotx) and the content of the .docx to be together.

Thank you
Avatar of xav056

ASKER

I already tried
doc=wordApp.documents.add(path,false,0,true)
doc.attachedTemplated="PthtoTemplate"
but the ribbon is not customized when this is done

Thank you
You can create the addin and deploy it then disable it i.e. set LoadBehavior to 0 in the registry. This way your addin will never load unless requested. Your standalone application that automates Word can then force the addin to load. You can access the add-ins whether loaded or not through the Word.Application object. The Connect property determines if the addin is loaded. So if "wordApp" is your reference to the Word Application object, you can do something like this:

for each addin as Micorosft.Office.Core.COMAddin in wordApp.COMAddins
    if addin.ProgID = "MyAddInName" then
        addin.Connect = True
        Exit For
    End If
Next

Inside your addin Startup code, you can manipulate the ribbons.

Good luck

Pete
Xenacode Ltd