I am currently doing the following to insert text at a specific point and it
works fine but I'd rather just code the text directly rather than reference
an autotext entry. How can I do this in a similar fashion to below? Only
autotext seems to have the insert method.
Set a = ActiveDocument.AttachedTemplate.AutoTextEntries("ORCON")
a.Insert Where:=Selection.Range, RichText:=True
Cindy M -WordMVP- - 08 Feb 2006 15:04 GMT
Hi Ml,
> I am currently doing the following to insert text at a specific point and it
> works fine but I'd rather just code the text directly rather than reference
[quoted text clipped - 3 lines]
> Set a = ActiveDocument.AttachedTemplate.AutoTextEntries("ORCON")
> a.Insert Where:=Selection.Range, RichText:=True
ActiveDocument.Content.Text = "This is my text"
Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org
This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :-)
Greg - 08 Feb 2006 15:36 GMT
Here are a few:
Sub Test()
Selection.TypeText "Hello ML"
'or
Dim oRng As Word.Range
Set oRng = ActiveDocument.Content 'or some other range
oRng.Text = "Hello ML"
End Sub
ML - 08 Feb 2006 16:32 GMT
Thanks. I should note that I also need to be able to set the font
properties. That seems to be the part I'm missing now.
Ex:
Dim fHidden As New Font
'Setup hidden font for marker
fHidden.Hidden = True
fHidden.Bold = True
fHidden.Color = wdColorOrange
a.Insert(Where:=Selection.Range, RichText:=True).Font = fHidden
> Here are a few:
>
[quoted text clipped - 5 lines]
> oRng.Text = "Hello ML"
> End Sub
Helmut Weber - 08 Feb 2006 16:57 GMT
Hi ML,
how about this one:
Sub test09()
Dim fHidden As New Font
fHidden.Hidden = True
fHidden.Bold = True
fHidden.Color = wdColorOrange
Dim sTmp As String
sTmp = "aaa"
With Selection
.Text = sTmp
.Font = fHidden
End With
End Sub

Signature
Greetings from Bavaria, Germany
Helmut Weber, MVP WordVBA
Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"