Normal.dot always asks to be saved

J

Jim

I have a Word Add-in which after I perform a merge and then close the
document it will ask to save normal.dot. Is there something wrong with
my add-in that is causing this?
Thanks
 
K

Ken Slovak - [MVP - Outlook]

If you are modifying the Word UI at all (custom menus or toolbars, etc.)
then you are dirtying the template. You would need to use the
CustomizationContext object before and after you make any changes.

Dim oCustContext As Object

' m_oDoc is the current Word document or WordMail item
Set oCustContext = m_oDoc.AttachedTemplate

'either check Saved state now and if dirty leave or always set Saved

' modifications here

Set oCustContext.Saved = True

'on close of document destroy customizations, then:
Set oCustContext.Saved = True
 
J

Jim

Thanks once again Ken for all of your help.
So if my add-in performs a mail merge.
I would:

wrdDoc = WordApp.Documents.Open(...)
custContext = wrdDoc.AttachedTemplate
perform merge process
custContext.Saved = true
wrdDoc.Close()....


Is this right or am I setting the custConext too late?

Thanks
 
K

Ken Slovak - [MVP - Outlook]

Try it and see :)

I'd step through the code and monitor the customization context to see when
and where it becomes dirty (.Saved = False). Then I'd decide where to
sprinkle in those statements.
 

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