1
votes

I would like to reply to an email without including the original email, but include the sender as the recipient, the subject, and my signature.

Currently I have Set objDoc = ActiveInspector.WordEditor. I tried looking for the body of the email here, so I can replace it with other text.

I would like to retain the Subject of the email I am replying to, the Sender, and the Recipient.

Here is the code I have for my current reply:

With oReply
    .BCC = bccField
    .CC = ccField
    .HTMLBody = "<HTML><Body><span>my reply here</span><Body></HTML>" & .HTMLBody & "<span>" & "Additional stuff" & "</span>"
End With 

I tried taking out the .HTMLBody in between the <span>s, which does take out the original user's message but also takes out my signature.

1
Create a new email just before this line. This will be opening along with your signature. Store that Signature in a variable and later call it in the place of .htmlbody. This is how i manage to get the signaturemanoj0790
@manoj0790 would you be able to give me an example in code?knowledge_is_power
Could you paste the full code?manoj0790
@manoj0790 unfortunately i cant. all i know is the .htmlbody contains both the signature and the user's response and i need to discard the user's response but not the signature.knowledge_is_power
I can try to modify the existing to make it work but not to write something from scratch.manoj0790

1 Answers

1
votes

Instead of using the reply functionality, just create a new mailItem and transfer the details over.

Example below uses the original email. So wherever you have Set oReply = (something).Reply you will replace or update that with Set originalMailItem = (Something). This (something) should be the original mail you are attempting to reply to.

In order to effectively insert the signature, we have to .Display the mailItem. Otherwise outlook will note generate the signature. Make sure the signature settings are correct on your outlook client to default to the desired signature for new mail items.

Set newMail = outApp.CreateItem(olMailItem) 'Create a new mail instead of replying to existing

With newMail
    .Display
    .HTMLBody = "<HTML><Body><span>my reply here</span><Body></HTML>" _
    & "<span>" & "Additional stuff" & "</span>" _
    & .HTMLBody 'HTMLBody already contains the signature once the email was displayed so we just tack it onto the end.
    .To = originalMailItem.SenderEmailAddress
    .CC = originalMailItem.CC
    .BCC = originalMailItem.BCC
    .Subject = originalMailItem.Subject
    '.Send     'To send the reply
End With