PDA

View Full Version : Solved: Help Please



Rakesh
05-15-2010, 11:18 AM
HI,


How to insert text “Tip 1:” in the starting of the every para when it not start with "@".

For example.

The quick brown fox jumps over the lazy dog.
@The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.

“Tip 1:” to be inserted in starting of the 1st, 3rd and 4th line.

Can it possible to do it in VBA coding.

Thanks,
Rakesh

Tinbendr
05-15-2010, 12:51 PM
Sub InsertText()
Dim Para As Paragraph

For Each Para In ActiveDocument.Paragraphs
If Left(Para, 1) <> "@" Then
Para.Range.InsertBefore "Tip1:"
End If
Next

End Sub

Rakesh
05-15-2010, 12:59 PM
Hi Tinbendr,

Thanks for your kind reply.

Its works fine.

:rotlaugh: Charmfully,
Rakesh