#1
|
|||
|
|||
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 |
#2
|
|||
|
|||
Code:
Sub ALLCAPS_TO_SMALLCAPS() Application.ScreenUpdating = False Dim oRng As Range Set oRng = ActiveDocument.Range With oRng.Find .ClearFormatting .Replacement.ClearFormatting .Text = "<[A-Z][A-Z]*>" .Replacement.Text = "" .Forward = True .Wrap = wdFindStop .Format = False .MatchWildcards = True While .Execute oRng.Select If MsgBox("Reformat?", vbQuestion + vbYesNo) = vbYes Then oRng.Case = wdTitleWord oRng.Font.SmallCaps = True End If oRng.Collapse wdCollapseEnd Wend End With Application.ScreenUpdating = True End Sub |
#3
|
|||
|
|||
Thanks Greg, but this asks for reformatting but dosen't show the selected word to reformat...
Something is missing i guess Quote:
|
#4
|
|||
|
|||
Take out this line:
Application.ScreenUpdating = False |
#5
|
|||
|
|||
Many thanks Greg ! That makes the difference !!!!
Thanks too for your word_tip_pages, they helped me a lot with word stuff ! |
Tags |
allcaps smallcaps user |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Staged Approval - Fillable Form - Digital Signature | Barters | Word | 0 | 06-03-2015 06:02 PM |
How to keep a word with capitalized first letter, but not at the beginning of a sentence? | xiangwulu | Word | 4 | 10-31-2014 09:00 AM |
change non capitalized text to capitalized text | antoniob | Excel | 8 | 10-13-2014 09:11 AM |
weird smallcaps phenomenon | franklekens | Word | 8 | 08-31-2014 12:35 AM |
Is there a way to find CAPITALIZED words in a doc? | Bobosmite | Word | 8 | 01-28-2014 03:53 PM |