From: Steve C on
Graham,

What is needed to make these steps work in programming? If I record a macro
while performing these steps, I get the following:

Selection.WholeStory
Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft

However, when run, this doesn't remove the leading tab. Thanks for any help
you can give me.

--
Steve C


"Graham Mayor" wrote:

> Select the text (CTRL+A)
> The CTRL+E (centre)
> then CTRL+L (left align) to remove all the leading spaces and tabs
>
> --
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> Graham Mayor - Word MVP
>
> My web site www.gmayor.com
> Word MVP web site http://word.mvps.org
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>
>
> Raul wrote:
> > I have to modifiy a number of documents that were formatted by
> > someone who formatted the documents using the tab character hundreds
> > of times.
> >
> > I'm using find and replace in some code to eliminate most of the
> > tabs, and that is working to a point. The next step is to learn how
> > to find and replace the first tab in a line only if it the first
> > thing in the line (i.e., it is not preceeded by any letter).
> >
> > Any help will be greatly appreciated.
> >
> > Thanks in advance,
> > Raul
>
>
>
From: Doug Robbins - Word MVP on
Use:

With ActiveDocument.Range.ParagraphFormat
.Alignment = wdAlignParagraphLeft
.LeftIndent = 0
.FirstLineIndent = 0
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

"Steve C" <SteveC(a)discussions.microsoft.com> wrote in message
news:2BC7F721-5E55-44E1-B4FC-498C5715A423(a)microsoft.com...
> Graham,
>
> What is needed to make these steps work in programming? If I record a
> macro
> while performing these steps, I get the following:
>
> Selection.WholeStory
> Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
> Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
>
> However, when run, this doesn't remove the leading tab. Thanks for any
> help
> you can give me.
>
> --
> Steve C
>
>
> "Graham Mayor" wrote:
>
>> Select the text (CTRL+A)
>> The CTRL+E (centre)
>> then CTRL+L (left align) to remove all the leading spaces and tabs
>>
>> --
>> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>> Graham Mayor - Word MVP
>>
>> My web site www.gmayor.com
>> Word MVP web site http://word.mvps.org
>> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>>
>>
>> Raul wrote:
>> > I have to modifiy a number of documents that were formatted by
>> > someone who formatted the documents using the tab character hundreds
>> > of times.
>> >
>> > I'm using find and replace in some code to eliminate most of the
>> > tabs, and that is working to a point. The next step is to learn how
>> > to find and replace the first tab in a line only if it the first
>> > thing in the line (i.e., it is not preceeded by any letter).
>> >
>> > Any help will be greatly appreciated.
>> >
>> > Thanks in advance,
>> > Raul
>>
>>
>>
From: macropod on
Hi Steve,

Are you sure the problem is with tabs, and not indents?

--
Cheers
macropod
[Microsoft MVP - Word]


"Steve C" <SteveC(a)discussions.microsoft.com> wrote in message news:2BC7F721-5E55-44E1-B4FC-498C5715A423(a)microsoft.com...
> Graham,
>
> What is needed to make these steps work in programming? If I record a macro
> while performing these steps, I get the following:
>
> Selection.WholeStory
> Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
> Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
>
> However, when run, this doesn't remove the leading tab. Thanks for any help
> you can give me.
>
> --
> Steve C
>
>
> "Graham Mayor" wrote:
>
>> Select the text (CTRL+A)
>> The CTRL+E (centre)
>> then CTRL+L (left align) to remove all the leading spaces and tabs
>>
>> --
>> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>> Graham Mayor - Word MVP
>>
>> My web site www.gmayor.com
>> Word MVP web site http://word.mvps.org
>> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>>
>>
>> Raul wrote:
>> > I have to modifiy a number of documents that were formatted by
>> > someone who formatted the documents using the tab character hundreds
>> > of times.
>> >
>> > I'm using find and replace in some code to eliminate most of the
>> > tabs, and that is working to a point. The next step is to learn how
>> > to find and replace the first tab in a line only if it the first
>> > thing in the line (i.e., it is not preceeded by any letter).
>> >
>> > Any help will be greatly appreciated.
>> >
>> > Thanks in advance,
>> > Raul
>>
>>
>>
From: Steve C on
Doug,

Thanks for the reply. I tried that, but the tabs remained. As a
workaround, I came up with this (although I'm sure it's not the most
efficient):

LineCount = ActiveDocument.Paragraphs.Count 'counts total # of lines in
document

For x = 1 To LineCount
Selection.Delete Unit:=wdCharacter, Count:=1 'removes tab character
Selection.MoveDown Unit:=wdLine, Count:=1
Next x

--
Steve C


"Doug Robbins - Word MVP" wrote:

> Use:
>
> With ActiveDocument.Range.ParagraphFormat
> .Alignment = wdAlignParagraphLeft
> .LeftIndent = 0
> .FirstLineIndent = 0
> End With
>
>
> --
> Hope this helps.
>
> Please reply to the newsgroup unless you wish to avail yourself of my
> services on a paid consulting basis.
>
> Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
>
> "Steve C" <SteveC(a)discussions.microsoft.com> wrote in message
> news:2BC7F721-5E55-44E1-B4FC-498C5715A423(a)microsoft.com...
> > Graham,
> >
> > What is needed to make these steps work in programming? If I record a
> > macro
> > while performing these steps, I get the following:
> >
> > Selection.WholeStory
> > Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
> > Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
> >
> > However, when run, this doesn't remove the leading tab. Thanks for any
> > help
> > you can give me.
> >
> > --
> > Steve C
> >
> >
> > "Graham Mayor" wrote:
> >
> >> Select the text (CTRL+A)
> >> The CTRL+E (centre)
> >> then CTRL+L (left align) to remove all the leading spaces and tabs
> >>
> >> --
> >> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> >> Graham Mayor - Word MVP
> >>
> >> My web site www.gmayor.com
> >> Word MVP web site http://word.mvps.org
> >> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> >>
> >>
> >> Raul wrote:
> >> > I have to modifiy a number of documents that were formatted by
> >> > someone who formatted the documents using the tab character hundreds
> >> > of times.
> >> >
> >> > I'm using find and replace in some code to eliminate most of the
> >> > tabs, and that is working to a point. The next step is to learn how
> >> > to find and replace the first tab in a line only if it the first
> >> > thing in the line (i.e., it is not preceeded by any letter).
> >> >
> >> > Any help will be greatly appreciated.
> >> >
> >> > Thanks in advance,
> >> > Raul
> >>
> >>
> >>