Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #5  
Old 03-07-2023, 06:26 AM
carrollmt carrollmt is offline Macro to change Small Caps to Lower Case Windows 10 Macro to change Small Caps to Lower Case Office 2016
Novice
Macro to change Small Caps to Lower Case
 
Join Date: Mar 2023
Posts: 4
carrollmt is on a distinguished road
Default

Hmm. When I run this, it ends up crashing Word. I think you might be onto something though. I might try recording it myself & see if that works.

Quote:
Originally Posted by BrianHoard View Post
I'm using Office 2019, but please see if this works for you. I recorded a Macro to do as you mentioned, then modified that code to get this. I added an Undo record so the entire script can be undone in one go, and used the document range instead of selection.
I now see that Graham posted an answer already. I'm still learning this, so you're likely better off going with his solution.


Code:
Sub smallCaps2Lowercase()
  Dim bhhUndo As UndoRecord
  Dim scriptName As String
  Dim rng_doc As Range
    
  scriptName = "smallCaps2Lowercase"
  Set rng_doc = ActiveDocument.Range
  Application.ScreenUpdating = False
  
  ' Begin undo record
  Set bhhUndo = Application.UndoRecord
  bhhUndo.StartCustomRecord (scriptName)
  
    ' Find/replace all text from smallCaps to lowercase.
  rng_doc.Find.ClearFormatting
  
  With rng_doc.Find.Font
    .SmallCaps = True
    .AllCaps = False
  End With
  
  rng_doc.Find.Replacement.ClearFormatting
  With rng_doc.Find.Replacement.Font
    .SmallCaps = False
    .AllCaps = False
  End With
  
  With rng_doc.Find
    .Text = "*"
    .Replacement.Text = LCase("")
    .Forward = True
    .Wrap = wdFindContinue
    .Format = True
    .MatchCase = False
    .MatchWholeWord = False
    .MatchAllWordForms = False
    .MatchSoundsLike = False
    .MatchWildcards = True
  End With
  
  rng_doc.Find.Execute Replace:=wdReplaceAll

  Application.ScreenUpdating = True
  bhhUndo.EndCustomRecord ' End undo

End Sub
Reply With Quote
 

Tags
macro, small caps



Similar Threads
Thread Thread Starter Forum Replies Last Post
Powerpoint-2019 Text in selected theme remains in All Caps even when small caps option is selected Tanasha4 PowerPoint 2 04-06-2019 07:53 PM
Macro to change Small Caps to Lower Case Toggle between upper case, lower case, etc... by one single macro on a Mac, to emulate Shift + F3 on gloub Word VBA 2 01-30-2019 12:40 PM
Macro to change Small Caps to Lower Case Need a Macro to Change Every Instance of Small Caps to All Caps and Reduce the Font by 2 Points CrossReach Word VBA 2 11-13-2017 09:21 AM
How to find CAPITALIZED names and change them into small caps dylan.ve Word VBA 5 02-25-2016 03:15 PM
Macro to change Small Caps to Lower Case Change lower case to caps whole document lmb100 Word 4 08-07-2015 06:57 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:10 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft