PDA

View Full Version : [SOLVED:] VBA reply while maintaining the original message location issue



Be_Dang3rous
11-19-2014, 09:02 AM
I looked through the search function and could not locate a solution so I am hoping someone can help. I am attempting to build a standardized response tool via VBA for my emails and am currently coming across a small issue of not knowing how to adapt a line of code to work the way i want it.

Basically once the user presses a button on the ribbon they are provided a UserForm to select what type of response they would like to send. Once selected the vba builds the HTML for the response and creates a Reply All message based on the current item in Outlook. My issue is I currently can only figure out 2 ways of doing this option 1 puts the response in the email, but the original message is lost (not good) and option 2 (the code is below) retains the original message but puts the response at the bottom, which I know is because of the "/body" piece, and i am unable to think of how to simply move the string titled msgBody to the top with the original email below. Anyone care to save me? Thank you!


.HTMLBody = Replace(.HTMLBody, "</body>", msgBody & "</body>", , , vbTextCompare)

Sorry after posting this I took a walk and realised that all i had to do was switch some placement around. Correct code end up as so:

.HTMLBody = Replace(msgBody & "</body>", "</body>", .HTMLBody, , , vbTextCompare)