Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #5  
Old 04-13-2025, 11:58 AM
Italophile Italophile is offline How do I insert a horizontal line at the end of a document? Windows 11 How do I insert a horizontal line at the end of a document? Office 2021
Expert
 
Join Date: Mar 2022
Posts: 563
Italophile is just really niceItalophile is just really niceItalophile is just really niceItalophile is just really nice
Default

Instead of adding a shape and a bunch of empty paragraphs it would be better to create two new styles - Journal Date with a top border set above the paragraph by a suitable distance (20pts in the screenshot) and a suitable space before (12pt in the screenshot), and Journal Date with a suitable space after (12pt in the screenshot).

Screenshot 2025-04-13 195654.png

Your code can then be:
Code:
Sub NewJournalEntry()
    With ActiveDocument.Paragraphs
        With .Last.Range
            'ensure that there is an empty paragraph at the end of the document
            .InsertParagraphAfter
        End With
        With .Last.Range
            .InsertDateTime DateTimeFormat:="dddd, MMMM d, yyyy", _
                InsertAsField:=False, DateLanguage:=wdEnglishUS, CalendarType:= _
                wdCalendarWestern, InsertAsFullWidth:=False
            .Style = "Journal Date"
        End With
        .Last.Range.InsertParagraphAfter
        With .Last.Range
            .InsertDateTime DateTimeFormat:="h:mm am/pm", InsertAsField:= _
                False, DateLanguage:=wdEnglishUS, CalendarType:=wdCalendarWestern, _
                InsertAsFullWidth:=False
            .Style = "Journal Time"
        End With
        .Last.Range.InsertParagraphAfter
        .Last.Style = wdStyleNormal
    End With
    
End Sub
Reply With Quote
 

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I insert a horizontal line at the end of a document? Creating a horizontal line in a document jjjoverthere Word 2 11-03-2018 05:39 PM
How do I insert a horizontal line at the end of a document? Horizontal line I can't delete goingvirtual Word 2 09-09-2018 02:58 AM
How do I insert a horizontal line at the end of a document? MS Word Horizontal Line Disappears after pressing Enter from end of line MikeWhite Word 5 01-20-2017 03:39 PM
How to change the default features for AutoShape horizontal line (button 'Insert horizontal line') 534tomasz Word 6 10-13-2016 02:33 AM
How do I insert a horizontal line at the end of a document? Putting a horizontal line in a Word Document -- should be simple, right? biotechguy Word 4 05-10-2010 11:58 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:27 PM.


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