Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #16  
Old 04-07-2015, 08:20 PM
Guessed's Avatar
Guessed Guessed is offline Find text, format part of text in italic Windows 7 32bit Find text, format part of text in italic Office 2010 32bit
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,969
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

This modification to Graham's code would include the footnotes and other document storyranges.


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)
    For Each oRng In ActiveDocument.StoryRanges
      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 oRng
  Next i
lbl_Exit:
  Exit Sub
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #17  
Old 04-07-2015, 09:53 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,101
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 of
Default

Don't even think of using the master document function. http://word.mvps.org/FAQs/General/Wh...ocsCorrupt.htm
__________________
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
  #18  
Old 04-20-2015, 12:27 PM
Salix Salix is offline Find text, format part of text in italic Windows 8 Find text, format part of text in italic Office 2007
Novice
 
Join Date: Mar 2015
Posts: 9
Salix is on a distinguished road
Default

It has worked beautifully. Like a charm. Thank you all so much again -- you have saved me countless hours of work and a bit of my sanity.
Reply With Quote
  #19  
Old 06-30-2022, 11:35 PM
mrsprings mrsprings is offline Find text, format part of text in italic Windows 10 Find text, format part of text in italic Office 2016
Novice
 
Join Date: Jun 2022
Posts: 3
mrsprings is on a distinguished road
Default Adapting this for brackets

Thanks for this macro. I've used it for adjusting commas. I'm now trying to adapt it to change brackets from italic to roman, but not having much luck.

For e.g., when the text preceding an opening bracket or following a closing bracket is roman, the brackets should be roman (while the text between brackets remains in italics). So example 1 would need to be changed to example 2.

Example 1: the next time (Wednesday) we all went together.
Example 2: the next time (Wednesday) we all went together.

Any suggestions on how this could be done using a macro would be greatly appreciated.
Reply With Quote
Reply

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 09:01 PM.


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