Using a style

A

Adrian

Hi All,

I wonder if someone could tell me a more reliable and
simple method of getting vba to TypeText to a word 2000
doc.

Currently I am using :=

Selection.Style = ActiveDocument.Styles("MyOwnStyle1)
Selection.TypeText Text:= "Just a test " & MyString

Selection.Style = ActiveDocument.Styles("MyOwnStyle2)
Selection.TypeText Text:= "Just another test " &
MyOtherString


I am getting erratic results.

I would appreciate it if someone could point out the error
of my ways :)

Thank you
Adrian
 
D

Doug Robbins - Word MVP - DELETE UPPERCASE CHARACT

See the article “Inserting text at a bookmark without deleting the bookmark”
at:

http://word.mvps.org/FAQs/MacrosVBA/InsertingTextAtBookmark.htm

and then apply the style to the .Range of the bookmark.
--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.
Hope this helps
Doug Robbins - Word MVP
 
K

Klaus Linke

Hi Adrian,

You may be missing the paragraph mark between your two paragraphs:
Selection.TypeText vbCr

Greetings,
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