View Single Post
 
Old 06-24-2017, 10:18 AM
iwonder iwonder is offline Windows 10 Office 2013
Novice
 
Join Date: Jun 2017
Location: France
Posts: 10
iwonder is on a distinguished road
Default Capitalized words to smallcaps on user approval

Hi !

I'm using the following code (adapted from Macropod's code [thanks to him !]) to do the job on all concerned words (2 characters or more) of the document, and it works fine.

But now I'd like the user to be asked if he wants the replacement with SmallCaps or not (if not, nothing will be changed) on each capitalized word found.
Could someone help me ?
Hope my English is clear enough...

Code:
Sub ALLCAPS_TO_SMALLCAPS()
'
Application.ScreenUpdating = False
With ActiveDocument.Range
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "<[A-Z][A-Z]*>"
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindStop
    .Format = False
    .MatchWildcards = True
    .Execute
  End With
  Do While .Find.Found
    .Case = wdTitleWord
    .Font.SmallCaps = True
    .Collapse wdCollapseEnd
    .Find.Execute
  Loop
End With
Application.ScreenUpdating = True
End Sub
I'm not a coder at all, just trying to adapt codes that I find, to my own needs.
Reply With Quote