Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-19-2019, 04:09 PM
jeffreybrown jeffreybrown is offline Find number and words without a period and bold Windows Vista Find number and words without a period and bold Office 2007
Expert
Find number and words without a period and bold
 
Join Date: Apr 2016
Posts: 673
jeffreybrown has a spectacular aura aboutjeffreybrown has a spectacular aura about
Default Find number and words without a period and bold

I have some numbering with paragraphs and I would like to bold the paragraph that is not a sub of the first paragraph.

Example:


1 Tree Farm.
1.1 Chicken house and barn
1.2 Farm land area.
2 Cherry tree orchard.
2.1 Watering hole out yonder.

In this example, I would like to bold #1 and #2.

I've been messing around with the find and replace, but can't work out the sequence.

Find: [0-9A-Z][!.]
Replace: ^&

But this does not get me very far.
Reply With Quote
  #2  
Old 08-19-2019, 10:45 PM
gmayor's Avatar
gmayor gmayor is offline Find number and words without a period and bold Windows 10 Find number and words without a period and bold Office 2016
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

Assuming that the numbers are typed text and not automatic numbers then you need a macro. It is not clear whether you want the paragraph or just the number bold, but I have included optional code for either Installing Macros :
Code:
Sub Macro1()
'Graham Mayor - https://www.gmayor.com - Last updated - 20 Aug 2019 
Dim oRng As Range
    Set oRng = ActiveDocument.Range
    With oRng.Find
        Do While .Execute(FindText:="[0-9]{1,} [A-Z]", MatchWildcards:=True)
            If oRng.Start = oRng.Paragraphs(1).Range.Start Then
                'bold just the number
                'oRng.End = oRng.End - 2
                'oRng.Font.Bold = True

                'bold the whole paragraph
                oRng.Paragraphs(1).Range.Font.Bold = True
            End If
            oRng.Collapse 0
        Loop
    End With
    Set oRng = Nothing
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
  #3  
Old 08-20-2019, 04:44 AM
jeffreybrown jeffreybrown is offline Find number and words without a period and bold Windows Vista Find number and words without a period and bold Office 2007
Expert
Find number and words without a period and bold
 
Join Date: Apr 2016
Posts: 673
jeffreybrown has a spectacular aura aboutjeffreybrown has a spectacular aura about
Default

Hi Graham and thank you for your help.

It doesn't appear to be working and the numbers are text not auto numbering.

Did I miss something?
Attached Files
File Type: docm Test.docm (20.1 KB, 8 views)
Reply With Quote
  #4  
Old 08-20-2019, 04:55 PM
Guessed's Avatar
Guessed Guessed is offline Find number and words without a period and bold Windows 10 Find number and words without a period and bold Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
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

Try this one for a different approach which applies styles which is the direction you 'should' be taking.
Code:
Sub FormatMyLists()
  With Options
    .AutoFormatApplyHeadings = True
    .AutoFormatApplyLists = True
    .AutoFormatApplyBulletedLists = True
    .AutoFormatApplyOtherParas = True
    .AutoFormatReplaceQuotes = False
    .AutoFormatReplaceSymbols = False
    .AutoFormatReplaceOrdinals = False
    .AutoFormatReplaceFractions = False
    .AutoFormatReplacePlainTextEmphasis = False
    .AutoFormatReplaceHyperlinks = True
    .AutoFormatPreserveStyles = False
    .AutoFormatPlainTextWordMail = True
  End With
  
  ActiveDocument.Kind = wdDocumentNotSpecified
  ActiveDocument.Range.AutoFormat
  ActiveDocument.Styles("List").Font.Bold = True

End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #5  
Old 08-20-2019, 05:58 PM
jeffreybrown jeffreybrown is offline Find number and words without a period and bold Windows 10 Find number and words without a period and bold Office 2016
Expert
Find number and words without a period and bold
 
Join Date: Apr 2016
Posts: 673
jeffreybrown has a spectacular aura aboutjeffreybrown has a spectacular aura about
Default

That is perfect Andrew. I can work with this. Thank you very much.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Find number and words without a period and bold VBA Find&Replace all bold, itlaic, underlined and highlighted words/characters Kalü Word VBA 22 04-24-2018 05:35 AM
Find number and words without a period and bold All words in document appear bold but are not! Ezra Word 4 07-31-2017 06:53 AM
Find number and words without a period and bold Best practice when allocating a period of time to a number of tasks jgregs Project 3 07-25-2014 10:43 AM
Find number and words without a period and bold setting the number of spaced after a period. -- need a new dictionary as well Straitsfan Word 1 10-31-2011 06:20 AM
Find number and words without a period and bold Autocorrect to make words Bold? GB89 Word 1 04-15-2010 09:04 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:05 AM.


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