Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Force word not to save template.

Status
Not open for further replies.

hsviljoen

Programmer
May 26, 2004
73
ZA
Hi there - Hope someone has an idea....

In the New document event of word I create a toolbar using code..... so this causes word to ask to save the template when you close it down. I cant change the toolbar code or even the event its happening in - What I've create now is a Addin with the following code:


Private Sub PsuedoAutoClose()


On Error GoTo err

ind = 1
If Word.Documents.Count > 0 Then

For ind = 1 To Word.Templates.Count

If ActiveDocument.AttachedTemplate = "Letter.dot" Or ActiveDocument.AttachedTemplate = "Fax.dot" Or ActiveDocument.AttachedTemplate = "Memo.dot" Then

Word.Templates(ind).Saved = True
End If
Next ind

End If

'If ActiveDocument.AttachedTemplate = "Letter.dot" Then Word.Templates(1).Saved = True
'If ActiveDocument.AttachedTemplate = "Fax.dot" Then Word.Templates(1).Saved = True
'If ActiveDocument.AttachedTemplate = "Memo.dot" Then Word.Templates(1).Saved = True
err:
Word.NormalTemplate.Saved = True

End Sub

but when i open a few templates simultaniosly this code doesn't run ..... any Idea on how I can force word NOT to save any template(And not to prompt to save)....
 
May I ask why you are opening "several" templates at once? And do you mean the actual template files themselves (which I suspect you are doing), or do you mean creating new files from the templates?

Can you be a bit more specific? If you are creating a new toolbar from the New event....from which template? It sounds like Normal.dot. But maybe not. If you are clicking the new Document button, unless you reprogram it, then that is the New Document event of Normal.dot. If you are going File, New and selecting a template - could you please state that?

In any case, a new document created from a template should never cause a message like that. If the New event creates/changes/shows/hides a toolbar,it should always return the system back to the original state on closing. In which case there are no changes.

It may be that what is happening is you are changing the toolbar from one template across to another. This is not a good idea.

Perhaps if you describe exactly what you are trying to do, we can help more.

It strikes me a quite peculiar that you need to have code to save attached templates like that.

Gerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top