I have been scanning various forums for VBA code to insert some text into an email at the cursor position. I found this code on a previous post in this forum and it works great for inserting a single line of text but I need to modify it to insert a paragraph
of text. Can anyone assist me with the correct code for this macro?
Here is the code I am starting with:
Sub InsertText()
Const sText As String = "Enter this text at the cursor"
On Error GoTo ErrHandler
If TypeName(ActiveWindow) = "Inspector" Then
If ActiveInspector.IsWordMail And ActiveInspector.EditorType = olEditorWord Then
ActiveInspector.WordEditor.Application.Selection.TypeText sText
End If
End If
Exit Sub
ErrHandler:
Beep
End Sub
I want to insert the following lines formatted as a paragraph.
Hello (name),
Thank you for your e-mail. A new membership card will be sent to your home address within the next two weeks.
Should you have any questions or require any additional information, please do not hesitate to contact me. My numbers are listed below.
Regards