Save changes to Document 1?

P

Patricia D

Help - I can't get rid of this question. Using an AutoExec module, there is
a subroutine to ensure that the Normal style has correct font and font size
as per our company standards.
However, this gives rise to the 'Save changes to Document 1?' question on
exit from Word - even when changes are not made. The
"ActiveDocument.AttachedTemplate.Saved = True" code was my attempt to get rid
of the pesky message!

Sub SetNormalStyle()
If (ActiveDocument.Styles(wdStyleNormal).Font.Size = 11 And _
ActiveDocument.Styles(wdStyleNormal).Font.Name = "Arial") Then GoTo
EndLabel
With ActiveDocument.Styles(wdStyleNormal)
.AutomaticallyUpdate = False
.BaseStyle = ""
.NextParagraphStyle = "Normal"
End With
With ActiveDocument.Styles(wdStyleNormal).Font
.Name = "Arial"
.Size = 11
End With
EndLabel:
ActiveDocument.AttachedTemplate.Saved = True
End Sub
 
J

Jezebel

Your code is modifying the definition of normal style in the activedocument.
This is a change to that document, so Word wants to save it. Are you
actually trying to save the change to the template itself?
 
P

Patricia D

Yes - I am actually trying to change the (default font in) the Normal Style
in the normal.dot template.
 
J

Jezebel

Try this

With Templates("Normal.dot").OpenAsDocument
With .Styles(wdStyleNormal).Font
.Size = 11
.Name = "Arial"
End With
.Close Savechanges:=True
End With
 
P

Patricia D

Thank you - it pretty much did the trick. It left one problem that current
normal style was not updated, but that only affected current document for
this session of Word, so I can live with that knowing that all future uses
will be fixed for good.
I forgot to mention I'm using Word 2007 (Beta), so I just changed the
normal.dot to normal.dotm.
 
J

Jezebel

Use

ActiveDocument.UpdateStyles

to copy the styles from the template to the 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