Sub BoldAndColorLinesStartingWithTripleHash()
Dim doc As Document
Dim para As Paragraph
Dim lineText As String
Dim rng As Range
Dim pos As Integer
' Set the document
Set doc = ActiveDocument
' Loop through each paragraph in the document
For Each para In doc.Paragraphs
lineText = para.Range.Text
pos = InStr(lineText, "###")
' If the paragraph starts with '###', format the entire paragraph
If pos = 1 Then
Set rng = para.Range
rng.Font.Bold = True
rng.Font.Color = wdColorBrown
rng.Font.Size = 11
End If
Next para
End SubTuesday, December 24, 2024
VBA Word - Text formatting if text begins with some text
The following VBA code formats the text which begins with hash:
Subscribe to:
Post Comments (Atom)
Hot Topics
-
In the previous post we have learnt about SSMS (SQL Server Management Studio) and how to connect with a SQL Server instance. In this post w...
-
By Ajeet Kumar RADAR CHART In radar chart, the categorical variable is displayed as spikes radiating from a central point. The values o...
-
In previous post , we learnt basic introduction to SQL Server . In this post we will learn about SSMS (SQL Server Management Studio) softwar...
No comments:
Post a Comment