Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 03-28-2016, 09:00 PM
macropod's Avatar
macropod macropod is offline Calling Sub Routine for Formatting recently Created Word Document Windows 7 64bit Calling Sub Routine for Formatting recently Created Word Document Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by rpb925 View Post
That is mind boggling. It's so concise.
Nah, it's verbose! Consider:
Code:
Sub Demo()
Dim arrTerms(), i As Long
arrTerms = Array("italics", "bold", "indent")
With ActiveDocument.Range.Find
    .MatchWildcards = True
    .Replacement.Text = "\3"
    For i = 0 To UBound(arrTerms)
        .Replacement.ClearFormatting
        .Text = "(\<" & arrTerms(i) & ")(\>)(*)\1/\2"
        Select Case i
            Case 0: .Replacement.Font.Italic = True
            Case 1: .Replacement.Font.Bold = True
            Case 2: .Replacement.ParagraphFormat.LeftIndent = 72
        End Select
        .Execute Replace:=wdReplaceAll
    Next
End With
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding tables to Created word document whilst other word document open Help rpb925 Word VBA 18 03-30-2016 04:45 PM
Calling Sub Routine for Formatting recently Created Word Document Uploading a previously created bibliography to be used in a new document JennJenn79 Word 1 07-16-2015 09:34 PM
Calling Sub Routine for Formatting recently Created Word Document was document created using 2010 or 2013 TDOG Word 1 10-12-2014 03:37 PM
Copy format created by a conditional formatting spk Excel 2 04-10-2013 04:41 AM
Word crashing on "sort" routine Kayale Word 0 04-12-2010 04:54 PM

Other Forums: Access Forums

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