Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 01-12-2018, 01:56 AM
gmayor's Avatar
gmayor gmayor is offline bold paragraph, add sign after first word.... Windows 10 bold paragraph, add sign after first word.... Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,137
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

That should be fairly simple e.g. with the cursor in the first of the two paragraphs run the following
Code:
Sub Macro1()
'Graham Mayor - http://www.gmayor.com - Last updated - 12 Jan 2018
Dim oRng As Range
Dim strEndWord() As Variant
Dim i As Long
    strEndWord = Array("so", "jas", "mf")
    Set oRng = Selection.Paragraphs(1).Range
    If oRng.Start = ActiveDocument.Paragraphs.Last.Range.Start Then
        MsgBox "You cannot process the last paragraph!"
        GoTo lbl_Exit
    End If
    With oRng
        .Font.Bold = True
        .End = .Words(1).End - 1
        .InsertAfter ChrW(9658)
        .End = .End + 1
        .Font.ColorIndex = wdRed
        .End = .Paragraphs(1).Range.End
        .End = .Next.Paragraphs(1).Range.End - 1
        .Start = .Words.Last.Start
        For i = 0 To UBound(strEndWord)
            If strEndWord(i) = LCase(.Text) Then
                .InsertBefore vbTab
                .Font.Bold = True
                Exit For
            End If
        Next i
    End With
lbl_Exit:
    Set oRng = Nothing
    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
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting part of a paragraph bold Fred256 Word VBA 4 10-07-2016 02:54 PM
How to parse bold sections of a paragraph? XmisterIS Word VBA 2 03-31-2014 02:54 PM
bold paragraph, add sign after first word.... Set paragraph text to bold. Sorcerer13 Word 1 09-04-2012 11:08 AM
bold paragraph, add sign after first word.... Word doesn't jumps tothe next lane when finds the dash sign!!!! why? Jamal NUMAN Word 3 04-10-2011 02:49 PM
paragraph sign appearing in document ajetrumpet Word 1 08-24-2010 05:46 AM

Other Forums: Access Forums

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