Results 1 to 6 of 6

Thread: Help with macro to insert date at the end of oulook contact body

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    VBAX Regular
    Joined
    May 2018
    Posts
    50
    Location
    THX great

    Can you pls help me on to

    oRng.Text = Format(Date, "mm/dd/yyyy") & " Call:" & vbCrLf
    ' could you pls be so kind and ad also actual time HH.MM

    .Save
    ' Please place the cursor at the end of what has been inserted to be able to start writing

    .Close 0
    'Do not Close for further inserting text there

    Public Sub AddDateEnd()
        ' Graham Mayor - https://www.gmayor.com - Last updated - 09 Nov 2020
        Dim olItem As ContactItem
        Dim olInsp As Inspector
        Dim wdDoc As ObjectDim oRng As Object
        On Error Resume Next
        Select Case Outlook.Application.ActiveWindow.Class
            Case olInspector
                Set olItem = ActiveInspector.CurrentItem
            Case olExplorer
                Set olItem = Application.ActiveExplorer.Selection.Item(1)
        End Select
        With olItem
            .Display
            Set olInsp = .GetInspector
            Set wdDoc = olInsp.WordEditor
            Set oRng = wdDoc.Range
            oRng.Collapse 0 'set to1 to put the date at the start of the body
            oRng.Text = Format(Date, "mm/dd/yyyy") & " Call:" & vbCrLf 'Pls ad also actual time HH.MM
            oRng.Font.Color = RGB(0, 128, 0) 'green
            .Save
            ' place the cursor at the end of what has been inserted to be able to start writing
            '.Close 0 'Do not Close for further inserting text there
        End With
        lbl_Exit:
        Set olItem = Nothing
        Set olInsp = Nothing
        Set wdDoc = Nothing
        Set oRng = Nothing
        Exit Sub
    End Sub
    Hope for further help
    THX
    Last edited by Aussiebear; 02-27-2025 at 01:19 PM.

Tags for this Thread

Posting Permissions

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