0

Using the thread Here I have created a macro that will open up a template in a new message window. My signature is still at the bottom though.

I want to empty the email content before adding the template, I'm new to VBA and not sure how to do it!

How is this done?

Current code:

Sub TemplateName()
    Set msg = Application.CreateItemFromTemplate("C:\Users\xyz\Desktop\template.oft")
    msg.Display
End Sub

I want to empty the email before running this sub.

Panomosh
  • 231

2 Answers2

0

Set the signature to none for "New messages".

File | Options | Mail | Signatures

New messages: (none)

niton
  • 1,832
0

Determine the length of the template text and keep only that.

Let's say the start of the signature is unique.

Dim sig_start as long
Dim template_text_end as long

sig_start = InStr(msg.Body, "unique text at the start of the signature")
template_text_end = sig_start - 1
msg.Body = Left(msg.Body, template_text_end)
debug.print template_text_end

When you have determined the position of the end of the template text you may decide not to figure it out every time.

You may need to try msg.HTMLBody.

Manipulating the body is tricky, you may lose the formatting.

niton
  • 1,832