CommandBarButton not getting deleted in MS Word

S

Sandesh Patnam

Ken and Pavan,

I am able to prevent the button from getting saved in Normal.dot in a
similar way that is specified by Pavan in his previous posts. I am actually
using the same Normal.dot template(Not a custom template) and adding the
button in OnStartUpComplete. The next immediate step that I did after adding
the button to the standard bar is that I am setting the Saved property of the
Normal template to true and fooling Word that no changes have been made in
the template and thus the changes are not being saved in the normal template.

As I already mentioned in my earlier posts, I am using two different
projects for Word and Outlook Plugins. I am doing the above mentioned steps
in Word's Connect.cs(Within the OnStartUpComplete api). I want to do the same
in Outlook's Connect.cs but I donot have access to the Word template within
Outlook's Connect.cs.

Please suggest me an alternative.
 
K

Ken Slovak - [MVP - Outlook]

MailItem.IsWordMail tells you if an Inspector has been opened using WordMail
(Word). The WordEditor property is actually a Word document object and
WordEditor.Parent is the Word Application object. WordEditor is a restricted
object, so you will get security prompts accessing it if you aren't running
as a trusted addin, however.
 
P

pavan

Just few thoughts on this!
Once you get the word application object you have access to the
templates loaded by word from wordApplication.Templates collection.

Hope this helps
 
K

Ken Slovak - [MVP - Outlook]

And also to WindowActivate and EnvelopeVisible and CustomizationContext and
all the other needed goodies.
 
S

Sandesh

Ken,

I a am able to access the WordEditor property of the Inspector. But I
couldn't find the parent property of the WordEditor. Can you please provide
me with the syntax how to access the parent property?

Thanks
--Sandesh
 
K

Ken Slovak - [MVP - Outlook]

WordEditor.Parent

That equals the Word Application object.

WordEditor is an Object, not typed. So you won't see any .Parent property.
If you look at Word.Document however you will see a .Parent property and
WordEditor = Word.Document.
 

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