Results 1 to 3 of 3
  1. #1
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    .LOG for Word (Word 2003)

    I recently discovered that if you type .LOG into Notepad, it adds an automatic Date/Time stamp each time you open the txt file. Can anyone help me to simulate this in Word. Each time I open the document, it must add a Date/Time stamp at the end of the current document similar to Notepad.

    The problem is also, where do I put the macro, as I want it to be available for all files. OK...the Blank Doc. Template can be used here, but once I save the file, the Log feature must still work for that file.

    Any ideas on this and the way the code will be structured? It must work identically to Notepad where you must type .LOG (uppercase sensitive) in the first line of the document. Only is this is the criteria, must the macro trigger for each file where the .LOG is found.

    Tricky one!!!!!

    Tx
    Regards,
    Rudi

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: .LOG for Word (Word 2003)

    Create the following macro in a module in your Normal.dot:

    Public Sub AutoOpen()
    If StrComp(Left(ActiveDocument.Content.Text, 4), ".LOG") = 0 Then
    ActiveDocument.Content.InsertParagraphAfter
    ActiveDocument.Content.InsertAfter Now
    End If
    End Sub

    This will run whenever you open a document, whether it is based on Normal.dot or not.

  3. #3
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: .LOG for Word (Word 2003)

    Awesome, I'll give it a try!
    Tx
    Regards,
    Rudi

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •