lkpederson
02-13-2015, 07:15 AM
All,
I have documents which occasionally have leading spaces between outline levels (set through Styles) and text. I have found macros which will delete these leading spaces but they all corrupt the Style for that paragraph. For some reason, the text will end up being formatted in the Style for the next paragraph.
And the dog ate my homework i.e. the code I was playing with got deleted. I've tried:
1. Trim() which didn't work.
2. Setting a paragraph range, looking at the first character, if it's a blank, then using Mid() to remove the space.
3. Range.Find
.Text = ([ ])([A-Z]*>)(^13)
.Replacement.Text = "\2\3"
.Style = original style
.Execute Replace:=wdReplaceAll
Suggestions?
TIA,
Lise
I have documents which occasionally have leading spaces between outline levels (set through Styles) and text. I have found macros which will delete these leading spaces but they all corrupt the Style for that paragraph. For some reason, the text will end up being formatted in the Style for the next paragraph.
And the dog ate my homework i.e. the code I was playing with got deleted. I've tried:
1. Trim() which didn't work.
2. Setting a paragraph range, looking at the first character, if it's a blank, then using Mid() to remove the space.
3. Range.Find
.Text = ([ ])([A-Z]*>)(^13)
.Replacement.Text = "\2\3"
.Style = original style
.Execute Replace:=wdReplaceAll
Suggestions?
TIA,
Lise