fumei: That's exactly what I do.
I have a template for my letters called Bf-MH97. As described, there is nothing special to it. When I write a new letter in ThisDocument a macro is triggered:
Code:
'*** Modul ThisDocument in Bf-MH97.dot *** MH 04.01.2005
'
Option Explicit
'
Private Sub Document_Close() 'MH 30.12.03
'setzt den Titel des Word-Fensters zurück
If Documents.Count = 1 Then Application.Caption = ""
End Sub
'
Private Sub Document_New() 'MH 30.12.03
'Titel des Word-Fensters löschen, damit im Icon _
der Taskleiste mehr vom Dateinamen sichtbar wird; _
ehem. AutoNew-Makro aufrufen
Application.Caption = " "
modLetterMacros.FormerAutoNew
End Sub
'
Private Sub Document_Open() 'MH 30.12.03
'Titel des Word-Fensters löschen, damit im Icon _
der Taskleiste mehr vom Dateinamen sichtbar wird; _
ehem. AutoOpen-Makro aufrufen
If Documents.Count = 1 Then Application.Caption = " "
modLetterMacros.FormerAutoOpen
End Sub
The macros are on a module 'modLetterMacros' and are called FormerAuto.. because this template was created under Winword6 as Bf-MH6. For Bf-MH97 I replaced
all the WordBasic instructions with VBA.
The macros - they are so simple - just do the following:
- both of them
a) adjust view of the document (ActiveDocument.View)
- FormerAutoNew only
b) my cell phone number is already in the text and has a bookmark on it; macro asks whether cell phone number should be shown, if not, deletes the text
c) the place where the address goes is marked by the word ADDRESS formatted as hidden text with a character style; macro looks for this character style, puts SELECTION.TEXT in a string variable and displays a msgBox asking whether I want to put the address here.
If so, selection is deleted and format resetted to paragraph format.
If not, everything stays as it was (because of the hidden character format it doesn't matter whether you put address in or not).
Nothing else is done.
My template runs in Word97 under Windows98 (why I have to shorten Application.Caption). The odd behaviour started suddenly about one year after the template was converted from WW6. And it is only with this peticular (no, peculiar) template. BTW:
every formatting is done with styles. That is why I said, my styles were complex. And: of course I had Kaspersky search for viruses. No avail.
Thank you for your interest.
Markus