Determining the position of a tab

J

Joanne

Hello,
I'm trying to write a macro that will:
1. determine the position of a tab at the beginning of each paragraph.
2. replace the tabs with first line indents.
I've looked on this site and in VB help. and I can't find anything. If
someone could just get me started on how to find the position of the tab, I
think I can figure this out. Thanks very much.
 
G

Greg Maxey

Joanne,

Not that you couldn't figure the rest of it out:

Sub ScratchMacro()
Dim oPar As Paragraph
For Each oPar In ActiveDocument.Range.Paragraphs
If Asc(oPar.Range.Characters.First) = 9 Then
oPar.FirstLineIndent = oPar.TabStops(1).Position
oPar.Range.Characters.First.Delete
End If
Next
End Sub
 
J

Joanne

Thank you so much! You're a doll.

Greg Maxey said:
Joanne,

Not that you couldn't figure the rest of it out:

Sub ScratchMacro()
Dim oPar As Paragraph
For Each oPar In ActiveDocument.Range.Paragraphs
If Asc(oPar.Range.Characters.First) = 9 Then
oPar.FirstLineIndent = oPar.TabStops(1).Position
oPar.Range.Characters.First.Delete
End If
Next
End Sub
 
Top