Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 04-13-2025, 08:45 AM
turnsouth turnsouth 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
Novice
How do I insert a horizontal line at the end of a document?
 
Join Date: Apr 2025
Posts: 4
turnsouth is on a distinguished road
Default How do I insert a horizontal line at the end of a document?

I've been trying to get this macro to work correctly.



It's for adding a new journal entry. It is suppose to go to the end of the document, insert a horizontal line, and then the date and time.

The date and time work correctly, but for some reason I can only get it to insert the line at the top of the document instead of the end.

I imagine that it has something to do with the range parameter of AddHorizontalLineStandard. But for the life of me, no matter what VBA reference or example I look at, I can not find what the values of 'range" can or is suppose to be.

Thanks,
Paul


Code:
Sub New_Journal_Entry()
'
' Macro2 Macro
'
'
    Selection.EndKey Unit:=wdStory
    ActiveDocument.InlineShapes.AddHorizontalLineStandard
    Selection.TypeParagraph
    Selection.TypeParagraph
    Selection.InsertDateTime DateTimeFormat:="dddd, MMMM d, yyyy", _
        InsertAsField:=False, DateLanguage:=wdEnglishUS, CalendarType:= _
        wdCalendarWestern, InsertAsFullWidth:=False
    Selection.TypeParagraph
    Selection.InsertDateTime DateTimeFormat:="h:mm am/pm", InsertAsField:= _
        False, DateLanguage:=wdEnglishUS, CalendarType:=wdCalendarWestern, _
        InsertAsFullWidth:=False
        Selection.TypeParagraph
        Selection.TypeParagraph
End Sub
Reply With Quote
 



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 01:36 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