JohnnyBravo
05-26-2006, 08:36 AM
I've recorded the following macro in Word 2003. As you can see, it's very simple, it takes you to the end of the document; inserts the date, inserts the time, and inserts two lines afterwards.
Now my only problem is that I want it to automatically run when the user opens the document. I thought the necessary function was called "autorun" but it's not working.
Sub Date_Time()
'
' Date_Time Macro
' Macro recorded 5/26/2006 by John
'
AutoRun
Selection.EndKey Unit:=wdStory
Selection.InsertDateTime DateTimeFormat:="dddd, MMMM dd, yyyy"
Selection.TypeText Text:=" "
Selection.InsertDateTime DateTimeFormat:="h:mm:ss am/pm"
Selection.TypeParagraph
Selection.TypeParagraph
End Sub
Now my only problem is that I want it to automatically run when the user opens the document. I thought the necessary function was called "autorun" but it's not working.
Sub Date_Time()
'
' Date_Time Macro
' Macro recorded 5/26/2006 by John
'
AutoRun
Selection.EndKey Unit:=wdStory
Selection.InsertDateTime DateTimeFormat:="dddd, MMMM dd, yyyy"
Selection.TypeText Text:=" "
Selection.InsertDateTime DateTimeFormat:="h:mm:ss am/pm"
Selection.TypeParagraph
Selection.TypeParagraph
End Sub