Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #13  
Old 04-06-2015, 09:45 PM
gmayor's Avatar
gmayor gmayor is offline Find text, format part of text in italic Windows 7 64bit Find text, format part of text in italic Office 2010 32bit
Expert
 
Join Date: Aug 2014
Posts: 4,144
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

It is a bit difficult to determine what is a 'title' without knowing how the document is formatted, but the following should format any of the listed characters (separated by the pipe character) that follows a character formatted as italic.
Code:
Sub Demo()
Const strList As String = ".|,|:|;|?|!"
Dim vChar As Variant
Dim i As Long
Dim oRng As Range
    vChar = Split(strList, "|")
    For i = LBound(vChar) To UBound(vChar)
        Set oRng = ActiveDocument.Range
        With oRng.Find
            Do While .Execute(vChar(i))
                oRng.Start = oRng.Start - 1
                If oRng.Characters(1).Font.Italic = True Then
                    oRng.Font.Italic = True
                End If
                oRng.Collapse 0
            Loop
        End With
    Next i
lbl_Exit:
    Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
 

Tags
find, italics, msword, punctuation



Similar Threads
Thread Thread Starter Forum Replies Last Post
Find text, format part of text in italic Macro to find text and replace with form field containing that text iiiiifffff Word VBA 16 06-04-2016 01:47 AM
Macro to find text in between two characters and then format selected text? qcom Word 5 02-19-2015 11:23 PM
Find text, format part of text in italic Need help on Macro 03- Find text - if text is blank then remove line simpleonline1234 Word VBA 1 02-25-2011 02:28 AM
Objective: Automatically export email text,attachment text to DB friendly format SilentLee Outlook 0 11-14-2010 02:45 PM
Find text, format part of text in italic Can't print bold or italic text cornettd PowerPoint 1 05-10-2010 10:07 AM

Other Forums: Access Forums

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