Sub DeleteAllHorizontalLines()
Dim oPara As Paragraph
Dim oShape As InlineShape
' --- PART 1: Remove Horizontal Lines that are Paragraph Borders ---
' Loop through every paragraph in the main document story
For Each oPara In ActiveDocument.StoryRanges(wdMainTextStory).Paragraphs
' Set the bottom border style to "None"
oPara.Borders(wdBorderBottom).LineStyle = wdLineStyleNone
Next oPara
' --- PART 2: Delete Horizontal Line Shapes (Drawings/Graphics) ---
' Loop through all Inline Shapes in the main document story
' We loop backwards in case multiple shapes are deleted in a row
Dim i As Long
For i = ActiveDocument.InlineShapes.Count To 1 Step -1
Set oShape = ActiveDocument.InlineShapes(i)
' Check if the shape is a dedicated horizontal line object
If oShape.Type = wdInlineShapeHorizontalLine Then
oShape.Delete
End If
Next i
MsgBox "All common horizontal lines have been removed!", vbInformation
End Sub
Applied Knowledge
ASP.NET Core, SQL Server, Excel & Access VBA, JavaScript and SAS
Saturday, May 30, 2026
VBA Word - Delete All Horizontal Lines from a Word document
Use the following VBA code to delete All Horizontal Lines from a Word document:
Create Multiple files using BAT command
You can Create 1oo Text files with file extension js, each filename begins with exercise word followed by a nuber, using following BAT command:
@echo off
FOR /L %%i IN (1,1,99) DO (
echo This is loop iteration %%i
type nul > exercise%%i.js
)
pause
The following BAT command creates a blank text file named exercise.txt:
@echo off
type nul > exercise.txt
Subscribe to:
Posts (Atom)
Hot Topics
-
In previous post , we learnt basic introduction to SQL Server . In this post we will learn about SSMS (SQL Server Management Studio) softwar...
-
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...