PDA

View Full Version : Solved: How to open new doc with ?update document styles? checked?



Gabor
07-15-2006, 01:13 PM
How can I achieve that when I click on the shortcut to Normal.dot in my Quicklaunch bar (I placed it there because Normal.dot contains everything I need and so I use this single template only), the new doc should open with the ?update document styles? box already checked in Tools>Templates and Extensions?
The only way I could do something like that was placing

Private Sub Document_New()
ActiveDocument.UpdateStylesOnOpen = True
End Sub


in Thisdocument module.
However, this puts the doc into ?modified? state and if I wish to close it without making any other changes to it I still have to go through some panels to convince Word that no, I don?t want so save the practically unused document and yes, I do want to close it.

Thank you very much for any solution.

fumei
07-16-2006, 12:55 AM
Seems a bit of misunderstanding here.

1. " the new doc should open with the ‘update document styles’ box already checked" - sorry, but a new document is NEVER "opened". A new document is created, or rather, cloned from a template.

2. " I click on the shortcut to Normal.dot in my Quicklaunch bar" - what does that mean? Technically, that would mean a shortcut to the file normal.dot. However, I don't think you mean that. Do you mean...well, simply a shortcut to Word? Because Word will fire using normal.dot.

3. Putting a new document as UpdateStylesOnOpen in Document_New is totally redundant. A new document will always BE created with the current styles. Do you mean to be using Document_Open?

mdmackillop
07-16-2006, 01:00 AM
I don't have the deep understanding of "all things Word" as Gerry, so I suggest you follow his recommendations, but to simply achieve what you are asking, try

Private Sub Document_Close()
If ActiveDocument.Characters.Count = 1 Then ActiveDocument.Saved = True
End Sub

Private Sub Document_new()
ActiveDocument.UpdateStylesOnOpen = True
End Sub

Gabor
07-16-2006, 02:31 AM
To fumei (Gerry)
1. You are right about your linguistic remarks, thank you. I will try to be more exact next time. However, English is not my mother tongue so I will never ever be able to be as exact as I should.:( But I am learning hard.:yes
2. Ditto, plus: the resulting, newly created files are not identical when I click on the whortcut to Word or on the shortcut to the file normal.dot. In the first case the tick box I was talking about is never checked, in the second it is always checked. So there is a difference in the settings (qualities) of the two files.

To mdmackillop
I copied your code into Thisdocument in normal.dot and now it works like a charm.:hi: Everything is fine now! Thank you very much!:friends:
Gabor