My client is a medical office that uses a master document for each patient to
keep xray and MRI reports. They begin each new report with a macro that
inserts a section break to a new page and draws in a blank report with a
"letterhead" up in the document header. The Xray reports and the MRI reports
require different letter heads because they are generated by different
departments, so I added a user form so the operator can select which blank
document to insert for the next report. However, for one of inserted
documents there is a problem that the Tahoma font in the header changes to
Times Roman. I don't know how to fix that but thought I could add code to
find the text and change the font back to Tahoma. This works except that it
leaves the Times Roman formatted text up there alongside the new Tahoma
formatted text. Example "This is my textThis is my text"

My questions are: 1) Is there a better way to approach my problem; 2) what's
missing from my code (as shown):

'
' test12 Macro
' Macro recorded 10/20/2005 and modified by RichardB
'
If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _
ActivePane.View.Type = wdOutlineView Then
ActiveWindow.ActivePane.View.Type = wdPrintView
End If
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
With Selection
.Text = "This is the Header"
.Font.Name = "Tahoma"
.Font.Size = 14
.Font.Bold = wdToggle
End With
ActiveDocument.Save
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
End Sub

Thank you...

Re: Macro to modify font in header by Charles

Charles
Thu Oct 20 16:43:25 CDT 2005

Some thoughts from a tyro who's been doing word processing for about 20
years. First, look into styles and assigning styles rather than individual
direct formatting. http://addbalance.com/usersguide/styles.htm The way you
are doing it, you are reinventing the wheel. I would recommend two sets of
header and footer styles for your different sorts of reports. The second set
should be based on the first set because you want both to be based on either
the header or footer styles.

Second, use AutoText to hold your base formats rather than separate
documents.

Third, use the range object rather than the Selection object to apply your
formatting. http://word.mvps.org/FAQs/MacrosVBA.htm#Ranges

Fourth, "Master Document" is a term of art in Word referring to a "feature"
that not only doesn't work but also destroys documents. See
http://www.mvps.org/word/FAQs/General/WhyMasterDocsCorrupt.htm. I'm sure
this is not what you were talking about.

--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://word.mvps.org/FAQs/ which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.


"richardb" <richardb@discussions.microsoft.com> wrote in message
news:0C2071FB-DC02-4EAB-848F-5AC46946A054@microsoft.com...
> My client is a medical office that uses a master document for each patient
> to
> keep xray and MRI reports. They begin each new report with a macro that
> inserts a section break to a new page and draws in a blank report with a
> "letterhead" up in the document header. The Xray reports and the MRI
> reports
> require different letter heads because they are generated by different
> departments, so I added a user form so the operator can select which blank
> document to insert for the next report. However, for one of inserted
> documents there is a problem that the Tahoma font in the header changes to
> Times Roman. I don't know how to fix that but thought I could add code to
> find the text and change the font back to Tahoma. This works except that
> it
> leaves the Times Roman formatted text up there alongside the new Tahoma
> formatted text. Example "This is my textThis is my text"
>
> My questions are: 1) Is there a better way to approach my problem; 2)
> what's
> missing from my code (as shown):
>
> '
> ' test12 Macro
> ' Macro recorded 10/20/2005 and modified by RichardB
> '
> If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
> ActiveWindow.Panes(2).Close
> End If
> If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _
> ActivePane.View.Type = wdOutlineView Then
> ActiveWindow.ActivePane.View.Type = wdPrintView
> End If
> ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
> With Selection
> .Text = "This is the Header"
> .Font.Name = "Tahoma"
> .Font.Size = 14
> .Font.Bold = wdToggle
> End With
> ActiveDocument.Save
> ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
> End Sub
>
> Thank you...
>
>



Re: Macro to modify font in header by richardb

richardb
Thu Oct 20 17:33:04 CDT 2005

Charles,

Thank you for your suggestions. Autotext sounds much better than what I'm
doing, but I have to try this. Each letterhead includes a different graphic
as a logo, plus lines and boxes. That will have to be stored in the autotext
and I have not tried such an autotext yet. I'll get back to you, probably
Monday.

"Charles Kenyon" wrote:

> Some thoughts from a tyro who's been doing word processing for about 20
> years. First, look into styles and assigning styles rather than individual
> direct formatting. http://addbalance.com/usersguide/styles.htm The way you
> are doing it, you are reinventing the wheel. I would recommend two sets of
> header and footer styles for your different sorts of reports. The second set
> should be based on the first set because you want both to be based on either
> the header or footer styles.
>
> Second, use AutoText to hold your base formats rather than separate
> documents.
>
> Third, use the range object rather than the Selection object to apply your
> formatting. http://word.mvps.org/FAQs/MacrosVBA.htm#Ranges
>
> Fourth, "Master Document" is a term of art in Word referring to a "feature"
> that not only doesn't work but also destroys documents. See
> http://www.mvps.org/word/FAQs/General/WhyMasterDocsCorrupt.htm. I'm sure
> this is not what you were talking about.
>
> --
> Charles Kenyon
>
> Word New User FAQ & Web Directory: http://addbalance.com/word
>
> Intermediate User's Guide to Microsoft Word (supplemented version of
> Microsoft's Legal Users' Guide) http://addbalance.com/usersguide
>
> See also the MVP FAQ: http://word.mvps.org/FAQs/ which is awesome!
> --------- --------- --------- --------- --------- ---------
> This message is posted to a newsgroup. Please post replies
> and questions to the newsgroup so that others can learn
> from my ignorance and your wisdom.
>
>
> "richardb" <richardb@discussions.microsoft.com> wrote in message
> news:0C2071FB-DC02-4EAB-848F-5AC46946A054@microsoft.com...
> > My client is a medical office that uses a master document for each patient
> > to
> > keep xray and MRI reports. They begin each new report with a macro that
> > inserts a section break to a new page and draws in a blank report with a
> > "letterhead" up in the document header. The Xray reports and the MRI
> > reports
> > require different letter heads because they are generated by different
> > departments, so I added a user form so the operator can select which blank
> > document to insert for the next report. However, for one of inserted
> > documents there is a problem that the Tahoma font in the header changes to
> > Times Roman. I don't know how to fix that but thought I could add code to
> > find the text and change the font back to Tahoma. This works except that
> > it
> > leaves the Times Roman formatted text up there alongside the new Tahoma
> > formatted text. Example "This is my textThis is my text"
> >
> > My questions are: 1) Is there a better way to approach my problem; 2)
> > what's
> > missing from my code (as shown):
> >
> > '
> > ' test12 Macro
> > ' Macro recorded 10/20/2005 and modified by RichardB
> > '
> > If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
> > ActiveWindow.Panes(2).Close
> > End If
> > If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _
> > ActivePane.View.Type = wdOutlineView Then
> > ActiveWindow.ActivePane.View.Type = wdPrintView
> > End If
> > ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
> > With Selection
> > .Text = "This is the Header"
> > .Font.Name = "Tahoma"
> > .Font.Size = 14
> > .Font.Bold = wdToggle
> > End With
> > ActiveDocument.Save
> > ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
> > End Sub
> >
> > Thank you...
> >
> >
>
>
>

Re: Macro to modify font in header by richardb

richardb
Mon Oct 24 09:22:04 CDT 2005

Dear Charles,

I used your second suggestion to employ autotext and this worked fine. I
learned that autotext will hold all the graphics, lines, etc. of the header.
I used a macro to open the header and insert the autotext. Great!

I will make a point of learning more about the range object.

No I didn't mean Master Document as the Word Feature.

Many thanks for your help, which was "right on target" and instructive.

richardb

"Charles Kenyon" wrote:

> Some thoughts from a tyro who's been doing word processing for about 20
> years. First, look into styles and assigning styles rather than individual
> direct formatting. http://addbalance.com/usersguide/styles.htm The way you
> are doing it, you are reinventing the wheel. I would recommend two sets of
> header and footer styles for your different sorts of reports. The second set
> should be based on the first set because you want both to be based on either
> the header or footer styles.
>
> Second, use AutoText to hold your base formats rather than separate
> documents.
>
> Third, use the range object rather than the Selection object to apply your
> formatting. http://word.mvps.org/FAQs/MacrosVBA.htm#Ranges
>
> Fourth, "Master Document" is a term of art in Word referring to a "feature"
> that not only doesn't work but also destroys documents. See
> http://www.mvps.org/word/FAQs/General/WhyMasterDocsCorrupt.htm. I'm sure
> this is not what you were talking about.
>
> --
> Charles Kenyon
>
> Word New User FAQ & Web Directory: http://addbalance.com/word
>
> Intermediate User's Guide to Microsoft Word (supplemented version of
> Microsoft's Legal Users' Guide) http://addbalance.com/usersguide
>
> See also the MVP FAQ: http://word.mvps.org/FAQs/ which is awesome!
> --------- --------- --------- --------- --------- ---------
> This message is posted to a newsgroup. Please post replies
> and questions to the newsgroup so that others can learn
> from my ignorance and your wisdom.
>
>
> "richardb" <richardb@discussions.microsoft.com> wrote in message
> news:0C2071FB-DC02-4EAB-848F-5AC46946A054@microsoft.com...
> > My client is a medical office that uses a master document for each patient
> > to
> > keep xray and MRI reports. They begin each new report with a macro that
> > inserts a section break to a new page and draws in a blank report with a
> > "letterhead" up in the document header. The Xray reports and the MRI
> > reports
> > require different letter heads because they are generated by different
> > departments, so I added a user form so the operator can select which blank
> > document to insert for the next report. However, for one of inserted
> > documents there is a problem that the Tahoma font in the header changes to
> > Times Roman. I don't know how to fix that but thought I could add code to
> > find the text and change the font back to Tahoma. This works except that
> > it
> > leaves the Times Roman formatted text up there alongside the new Tahoma
> > formatted text. Example "This is my textThis is my text"
> >
> > My questions are: 1) Is there a better way to approach my problem; 2)
> > what's
> > missing from my code (as shown):
> >
> > '
> > ' test12 Macro
> > ' Macro recorded 10/20/2005 and modified by RichardB
> > '
> > If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
> > ActiveWindow.Panes(2).Close
> > End If
> > If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _
> > ActivePane.View.Type = wdOutlineView Then
> > ActiveWindow.ActivePane.View.Type = wdPrintView
> > End If
> > ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
> > With Selection
> > .Text = "This is the Header"
> > .Font.Name = "Tahoma"
> > .Font.Size = 14
> > .Font.Bold = wdToggle
> > End With
> > ActiveDocument.Save
> > ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
> > End Sub
> >
> > Thank you...
> >
> >
>
>
>

Re: Macro to modify font in header by Charles

Charles
Mon Oct 24 10:22:26 CDT 2005

You are welcome, glad I guessed right.
--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://word.mvps.org/FAQs/ which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.

"richardb" <richardb@discussions.microsoft.com> wrote in message
news:1534AFA8-B037-4CEF-BC8F-242BC34347E7@microsoft.com...
> Dear Charles,
>
> I used your second suggestion to employ autotext and this worked fine. I
> learned that autotext will hold all the graphics, lines, etc. of the
> header.
> I used a macro to open the header and insert the autotext. Great!
>
> I will make a point of learning more about the range object.
>
> No I didn't mean Master Document as the Word Feature.
>
> Many thanks for your help, which was "right on target" and instructive.
>
> richardb
>
> "Charles Kenyon" wrote:
>
>> Some thoughts from a tyro who's been doing word processing for about 20
>> years. First, look into styles and assigning styles rather than
>> individual
>> direct formatting. http://addbalance.com/usersguide/styles.htm The way
>> you
>> are doing it, you are reinventing the wheel. I would recommend two sets
>> of
>> header and footer styles for your different sorts of reports. The second
>> set
>> should be based on the first set because you want both to be based on
>> either
>> the header or footer styles.
>>
>> Second, use AutoText to hold your base formats rather than separate
>> documents.
>>
>> Third, use the range object rather than the Selection object to apply
>> your
>> formatting. http://word.mvps.org/FAQs/MacrosVBA.htm#Ranges
>>
>> Fourth, "Master Document" is a term of art in Word referring to a
>> "feature"
>> that not only doesn't work but also destroys documents. See
>> http://www.mvps.org/word/FAQs/General/WhyMasterDocsCorrupt.htm. I'm sure
>> this is not what you were talking about.
>>
>> --
>> Charles Kenyon
>>
>> Word New User FAQ & Web Directory: http://addbalance.com/word
>>
>> Intermediate User's Guide to Microsoft Word (supplemented version of
>> Microsoft's Legal Users' Guide) http://addbalance.com/usersguide
>>
>> See also the MVP FAQ: http://word.mvps.org/FAQs/ which is awesome!
>> --------- --------- --------- --------- --------- ---------
>> This message is posted to a newsgroup. Please post replies
>> and questions to the newsgroup so that others can learn
>> from my ignorance and your wisdom.
>>
>>
>> "richardb" <richardb@discussions.microsoft.com> wrote in message
>> news:0C2071FB-DC02-4EAB-848F-5AC46946A054@microsoft.com...
>> > My client is a medical office that uses a master document for each
>> > patient
>> > to
>> > keep xray and MRI reports. They begin each new report with a macro that
>> > inserts a section break to a new page and draws in a blank report with
>> > a
>> > "letterhead" up in the document header. The Xray reports and the MRI
>> > reports
>> > require different letter heads because they are generated by different
>> > departments, so I added a user form so the operator can select which
>> > blank
>> > document to insert for the next report. However, for one of inserted
>> > documents there is a problem that the Tahoma font in the header changes
>> > to
>> > Times Roman. I don't know how to fix that but thought I could add code
>> > to
>> > find the text and change the font back to Tahoma. This works except
>> > that
>> > it
>> > leaves the Times Roman formatted text up there alongside the new Tahoma
>> > formatted text. Example "This is my textThis is my text"
>> >
>> > My questions are: 1) Is there a better way to approach my problem; 2)
>> > what's
>> > missing from my code (as shown):
>> >
>> > '
>> > ' test12 Macro
>> > ' Macro recorded 10/20/2005 and modified by RichardB
>> > '
>> > If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
>> > ActiveWindow.Panes(2).Close
>> > End If
>> > If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow.
>> > _
>> > ActivePane.View.Type = wdOutlineView Then
>> > ActiveWindow.ActivePane.View.Type = wdPrintView
>> > End If
>> > ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
>> > With Selection
>> > .Text = "This is the Header"
>> > .Font.Name = "Tahoma"
>> > .Font.Size = 14
>> > .Font.Bold = wdToggle
>> > End With
>> > ActiveDocument.Save
>> > ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
>> > End Sub
>> >
>> > Thank you...
>> >
>> >
>>
>>
>>