Results 1 to 1 of 1
  1. #1
    5 Star Lounger
    Join Date
    Mar 2001
    Location
    New York, NY
    Posts
    922
    Thanks
    2
    Thanked 12 Times in 11 Posts

    Outlook mail message / VBA

    I've found the answer to this: "False, False, False" at the end of the InsertFile statement.

    We want to provide our users with the ability to insert pre-determined text into an Outlook email message or appointment.

    In the following code, Selection.TypeText functions as it does in Word. Selection.InsertFile inserts an icon representing the actual file. We would like it to insert range "Test" from the Word file, as would be the case in Word/VBA. Is there a way to insert only the text of a file (or a range of that file) into an Outlook message?

    Thanks.

    Code:
    Sub InsertTextEmailMessage()
    
    On Error GoTo ErrHandler
    If TypeName(ActiveWindow) = "Inspector" Then
        If ActiveInspector.IsWordMail And ActiveInspector.EditorType = olEditorWord Then
            ActiveInspector.WordEditor.Application.Selection.typetext "This is my text."
            ActiveInspector.WordEditor.Application.Selection.insertfile "C:\temp\Outlook messages.docx", "Test"
        End If
    End If
    Exit Sub
    ErrHandler:
    
    End Sub
    Last edited by richardbarrett; 2013-09-24 at 18:21.

Posting Permissions

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