VBA Word Help

jmoney4u
08-06-2001, 10:33 AM
This should not be too hard but I am not very good at word VBA. All I want to do is search a paragraph for a wrd with a number after it. The word is TABSTART and the number varies between 1-9. So for instance the first occurance may be TABSTART5 then the next one TABSTART2.

I just want to find the string, and put it in a variable so I can get the 'random' number that follows the TABSTART so I can use that as the number of columns in a table.

Help!!!!

BlueRaja
08-08-2001, 02:58 AM
Hi,

You could try something like...

Selection.Expand wdParagraph
Selection.Find.ClearFormatting

With Selection.Find
.Text = "TABSTART"
End With
Selection.Find.Execute
Selection.MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdExtend
Dim x
x = Right(Selection, 1)
MsgBox x

Hope this helps.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum