Just realised that this macro selects the first table in the document, and I
have several. I want to select the second cell of row 1 of the table in
which the cursor is, then replace it with an autotext entry, as set out
below.
The learning curve for VB is steep...
On 18/4/07 22:12, in article C24C483B.481D%sol@solapache.com, "Sol Apache"
<sol@solapache.com> wrote:
> I want to select text in a cell of a table where the cursor is and replace
> it with an autotext entry. This macro selects the cell, but I get an error
[quoted text clipped - 6 lines]
>
> Sol
Greg Maxey - 18 Apr 2007 23:08 GMT
Sub Scratchmacro()
Dim oRng As Word.Range
Set oRng = Selection.Tables(1).Cell(1, 2).Range
oRng.MoveEnd wdCharacter, -1
NormalTemplate.AutoTextEntries("Attention:").Insert oRng
End Sub

Signature
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.
> Just realised that this macro selects the first table in the
> document, and I have several. I want to select the second cell of row
[quoted text clipped - 17 lines]
>>
>> Sol
Sol Apache - 18 Apr 2007 23:25 GMT
That works perfectly, Greg. Thank you very much.
On 18/4/07 23:08, in article eS7naYggHHA.4260@TK2MSFTNGP03.phx.gbl, "Greg
Maxey" <gmaxey@mvps.oSCARrOMEOgOLF> wrote:
> Sub Scratchmacro()
> Dim oRng As Word.Range
> Set oRng = Selection.Tables(1).Cell(1, 2).Range
> oRng.MoveEnd wdCharacter, -1
> NormalTemplate.AutoTextEntries("Attention:").Insert oRng
> End Sub