Open doc and go to end

Hello Experts,

I would like to know how I can add code to the on open event of a word doc:
go to the end
Add current date in this format: Tuesday, February 24, 2009

Thank you
PetrobrasAsked:
Who is Participating?
 
CalmSoulConnect With a Mentor Commented:
try this
Private Sub Document_Open()
    ActiveDocument.Bookmarks("\EndOfDoc").Select
 
 Selection.InsertDateTime DateTimeFormat:="dddd, MMMM dd, yyyy", _
        InsertAsField:=False, DateLanguage:=wdEnglishUS, CalendarType:= _
        wdCalendarWestern, InsertAsFullWidth:=False
 
End Sub

Open in new window

0
 
CalmSoulCommented:
Here you go
Sub Macro2()
 
    Selection.MoveDown Unit:=wdScreen, Count:=1
    Selection.EndKey Unit:=wdLine
    Selection.EndKey Unit:=wdLine
    Selection.MoveDown Unit:=wdScreen, Count:=3
    Selection.TypeParagraph
    Selection.MoveDown Unit:=wdScreen, Count:=1
    Selection.TypeParagraph
    Selection.InsertDateTime DateTimeFormat:="dddd, MMMM dd, yyyy", _
        InsertAsField:=False, DateLanguage:=wdEnglishUS, CalendarType:= _
        wdCalendarWestern, InsertAsFullWidth:=False
End Sub

Open in new window

0
 
PetrobrasAuthor Commented:
Hi Calmsoul,

Thanks for the code.  I wonder if I can do this though for end of doc:
Private Sub Document_Open()
    ThisDocument.Bookmarks("\EndOfDoc").Select
   

End Sub

then insert your code for date:
 Selection.InsertDateTime DateTimeFormat:="dddd, MMMM dd, yyyy", _
        InsertAsField:=False, DateLanguage:=wdEnglishUS, CalendarType:= _
        wdCalendarWestern, InsertAsFullWidth:=False

End Sub

==========
Giving:
Private Sub Document_Open()
    ThisDocument.Bookmarks("\EndOfDoc").Select

 Selection.InsertDateTime DateTimeFormat:="dddd, MMMM dd, yyyy", _
        InsertAsField:=False, DateLanguage:=wdEnglishUS, CalendarType:= _
        wdCalendarWestern, InsertAsFullWidth:=False

End Sub

Let me know.  Thanks
0
 
PetrobrasAuthor Commented:
that worked great!  Thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.