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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top