Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 10-07-2016, 03:59 AM
gmayor's Avatar
gmayor gmayor is offline For next fail Windows 10 For next fail Office 2016
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

Adding this line, simply removes the formatting you have added, by replacing the range with what it was originally. What you should have is

Code:
Dim p As Paragraph 'Declare your variables
Dim Thistext As String
Dim meetssomecondition As Boolean

    For Each p In ActiveDocument.Paragraphs
        meetssomecondition = False 'Set the boolean value to false for each paragraph0
        Thistext = p.Range.Text 'Record the text content of the paragraph range
Debug.Print Thistext 
        If Left(Thistext, 5) = "Lorem" Then meetssomecondition = True 'add a condition relating to the text that will set the boolean value to True
        If meetssomecondition = True Then 'If that condition is met set the paragraph range to bold font
            p.Range.Font.Bold = True
        End If
    Next p
__________________
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
 

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert File Printout w/ PDF fail jsilvoy OneNote 0 03-05-2015 06:44 PM
Fail to insert “table of content”, Jamal NUMAN Word 7 11-16-2013 01:21 AM
Big presentation, links fail: solution theredspecial PowerPoint 6 08-26-2013 10:35 PM
Office repair fail markg2 Office 1 08-18-2013 07:23 AM
Shortcuts Fail sussertown Outlook 0 02-16-2009 06:38 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:20 AM.


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