Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #7  
Old 11-09-2023, 09:10 AM
gmaxey gmaxey is offline Formatting specific paragraphs with styles without using Selection Windows 10 Formatting specific paragraphs with styles without using Selection Office 2019
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,601
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

You kind of have your answer already in this thread


Code:
Sub ScratchMacro()
'A basic Word Macro coded by Gregory K. Maxey
 Dim oPar As Paragraph
 Dim oRng As Range
   With ActiveDocument
     Set oRng = .Range
     oRng.Start = .Paragraphs(3).Range.Start
   End With
   'Format unnumbered subtitles
   For Each oPar In oRng.Paragraphs
     If oPar.Range.ComputeStatistics(wdStatisticLines) = 1 _
          And oPar.Range.ParagraphFormat.Alignment = wdAlignParagraphLeft _
          And Not oPar.Range Like "*[0-9]*" Then
       oPar.Range.Style = "Body Text"
     End If
   Next oPar
 lbl_Exit:   Set oPar = Nothing
   Exit Sub
 End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Formatting specific paragraphs with styles without using Selection Assign different heading styles for different paragraphs Thorin23 Word VBA 3 05-02-2021 06:22 AM
Formatting all paragraphs based on pre defined styles afif Word VBA 0 07-26-2019 06:18 AM
Formatting specific paragraphs with styles without using Selection Make paragraphs appear according to specific combination razdul Word VBA 2 04-17-2019 06:17 AM
Trouble Formatting Specific Paragraphs - Bullets, Spacing, Centering, etc adzialo Word 2 05-01-2017 12:53 PM
Formatting specific paragraphs with styles without using Selection Selection of all Text for a specific page in word is spanning selection across pages ramsgarla Word VBA 9 12-05-2012 03:23 AM

Other Forums: Access Forums

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