Results 1 to 1 of 1
Thread: Outlook mail message / VBA
2013-09-24, 18:03 #1
- Join Date
- Mar 2001
- New York, NY
- 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?
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.