Normal.dot always asks to be saved

  • Thread starter Thread starter Jim
  • Start date Start date
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
 
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
 
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
 
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.
 
Back
Top