M
MikeB77
Hello
I'm trying to tidy up word text by removing or applying double spaces after
sentences. the selected text to tidy MAY include tables But I don't want to
change text that is in a tables - just text outside tables.
How can I limit .find to non-table text.? I've stumbled across
range.information(wdWithInTable) as a lead but can weave this in.
Or could I redefine my myRng text to exclude tables?
my snippets so far:
Sub mySub
'set myRng from selection or story.. it depends
'get A which is either ' ' or ' ' depending on if proportional font or not
'call my function (below) for various sentence ending punctuation:
MakeChanges4(myRng, ".", ".", A)
MakeChanges4(myRng, ":", ":", A)
MakeChanges4(myRng, "[\!]", "!", A)
MakeChanges4(myRng, "[\?]", "?", A)
end Sub
Private Function MakeChanges4(myRange As Range, findPunct As String, punct
As String, newSpace As String)
sp = "[ ]{1,}" 'spaces string using wildcard format
myRange.Find.ClearFormatting
' MY QUESTION HERE - HOW TO LIMIT THIS TO REPLACE ONLY NON TABLE TEXT
myRange.Find.Execute FindText:=findPunct & sp, _
ReplaceWith:=punct & newSpace, MatchCase:=0, _
Replace:=wdReplaceAll, MatchWildcards:=True
End Function
Thanks in advance
Mike
I'm trying to tidy up word text by removing or applying double spaces after
sentences. the selected text to tidy MAY include tables But I don't want to
change text that is in a tables - just text outside tables.
How can I limit .find to non-table text.? I've stumbled across
range.information(wdWithInTable) as a lead but can weave this in.
Or could I redefine my myRng text to exclude tables?
my snippets so far:
Sub mySub
'set myRng from selection or story.. it depends
'get A which is either ' ' or ' ' depending on if proportional font or not
'call my function (below) for various sentence ending punctuation:
MakeChanges4(myRng, ".", ".", A)
MakeChanges4(myRng, ":", ":", A)
MakeChanges4(myRng, "[\!]", "!", A)
MakeChanges4(myRng, "[\?]", "?", A)
end Sub
Private Function MakeChanges4(myRange As Range, findPunct As String, punct
As String, newSpace As String)
sp = "[ ]{1,}" 'spaces string using wildcard format
myRange.Find.ClearFormatting
' MY QUESTION HERE - HOW TO LIMIT THIS TO REPLACE ONLY NON TABLE TEXT
myRange.Find.Execute FindText:=findPunct & sp, _
ReplaceWith:=punct & newSpace, MatchCase:=0, _
Replace:=wdReplaceAll, MatchWildcards:=True
End Function
Thanks in advance
Mike