Programmer_n
04-13-2016, 03:23 AM
Friends,
I am trying to create a capitalization VBA for different scenarios that my documents frequent.
The code below forms the basis of my approach.
With ActiveDocument.Range.Find
.ClearFormatting
With .Replacement.Font
.SmallCaps = False
.AllCaps = True
End With
.MatchWildcards = True
.Text = "\! ([a-z])"
.Replacement.Text = "! \1"
.Execute Replace:=wdReplaceAll
End With
Now the scenarios:
If a double quote succeeds a colon, capitalize the initial letter of word after the opening double quotes. ex. ( : "Capital blah blah blah")
If it is only double quotes, lowercase the initial letter after starting double quote ex. (sample words " lowercase.")
If a parentheses comes with in a sentence lowercase the first letter after parentheses ex. ( sample words (lowercase)
If a sentence starts with parentheses then capitalize initial letter after parentheses ex. Words. (Capital ....)
I am sure the answer is in .Text modification.:think:. I tired to use Char^34 ascii value for double quotes but not finding a proper solution.
Please help.
I am trying to create a capitalization VBA for different scenarios that my documents frequent.
The code below forms the basis of my approach.
With ActiveDocument.Range.Find
.ClearFormatting
With .Replacement.Font
.SmallCaps = False
.AllCaps = True
End With
.MatchWildcards = True
.Text = "\! ([a-z])"
.Replacement.Text = "! \1"
.Execute Replace:=wdReplaceAll
End With
Now the scenarios:
If a double quote succeeds a colon, capitalize the initial letter of word after the opening double quotes. ex. ( : "Capital blah blah blah")
If it is only double quotes, lowercase the initial letter after starting double quote ex. (sample words " lowercase.")
If a parentheses comes with in a sentence lowercase the first letter after parentheses ex. ( sample words (lowercase)
If a sentence starts with parentheses then capitalize initial letter after parentheses ex. Words. (Capital ....)
I am sure the answer is in .Text modification.:think:. I tired to use Char^34 ascii value for double quotes but not finding a proper solution.
Please help.