Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 02-05-2022, 12:24 PM
Ulodesk Ulodesk is offline From recorded tro rational Windows 10 From recorded tro rational Office 2016
Word 2013 Expert Cert
From recorded tro rational
 
Join Date: Sep 2009
Location: Virginia
Posts: 872
Ulodesk is on a distinguished road
Default From recorded tro rational

Hello. I have recorded the following multi-stage macro. I know that it's longer than needed but have really no idea what I can safely remove. Would one of you experts be kind enough to trim it down for me? Thank you very much.



Code:
Sub PreEdit()
'
' Macro to replace in the entire document:
' straight single and double straight quotes with curly;
' remove tabs;
' replace manual line returns with hard returns; and
' remove empty paragraphs
'
'
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "'"
        .Replacement.Text = "'"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    With Selection.Find
        .Text = """"
        .Replacement.Text = """"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    With Selection.Find
        .Text = "^t"
        .Replacement.Text = ""
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "^l"
        .Replacement.Text = "^p"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    With Selection.Find
        .Text = "^p^p"
        .Replacement.Text = "^p"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
End Sub
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
From recorded tro rational Please help! Macros not recorded as expected Chibiberu Word VBA 4 03-30-2019 02:42 AM
Modify recorded macro to run until end of document peter961 Word VBA 1 09-04-2017 02:50 PM
Embedded Video Not Playing in Recorded Presentation bhadden1 PowerPoint 0 08-16-2017 03:07 PM
Add previously recorded sound and synchronize with slide annimations daniellouw PowerPoint 1 03-03-2017 11:14 AM
Can I record more to add on to a recorded Macro? Clueless in Seattle Word VBA 3 05-25-2015 01:21 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:08 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