Word 2000: TypeParagraph causes Font to Change

V

VBA Coder

Does anyone know how I can issue a .TypeParagraph on my selection object
without having the font change to my Default Font?

I have a template where I am inserting text into the document. In my
Template, the entire document has been formatted to use Arial font.
However, my Default Font is "Times New Roman" for my Microsoft Word (Select
Format/Font from the main menu).

My sample code is below:

With Selection
' Enter some dummy text - the font is Arial at this point
.TypeText Text:="This font is Arial"
' Now issue a new paragraph - just like pressing the ENTER key
.TypeParagraph
' Now my Font is my default font - Times New Roman
.TypeText Text:="Now my font is Times New Roman, NOT Arial"
End With


Why is my font changing? If I go into blank document and start typing my
sample text with Arial font, and press the ENTER key, my font does not
change, why is it changing here when I issue the .TypeParagraph?

According to the following MSDN article on the TypeParagraph,
http://msdn.microsoft.com/library/d...y/en-us/office97/html/output/F1/D4/S5ADCE.asp,
"This method corresponds to the functionality of the ENTER key". Has
something changed from Office97 to Office 2000?
 
K

Klaus Linke

Hi VBA Coder,

The same thing would probably happen in the user interface, with the ENTER
key.

The font for the next paragraph is determined by the style of that
paragraph.

Instead of setting the font in your macro, it would be better to set the
proper style.
There isn't such a thing as a "default font" for the whole document.
"Format > Font > Default" changes the font of the "Normal" style.

You should also look out for "Style for following paragraph" in the style
definition.
"Selection.TypeParagraph" might switch to another style, according to this
setting.

Regards,
Klaus
 

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