Solved

Excel VBA- Include signature in Outlook email message

Posted on 2012-12-28
5
634 Views
Last Modified: 2012-12-29
Hi Experts,

Does anyone know how to include an end user's signature in the body of an email message?
Sample-Workbook.xlsm
0
Comment
Question by:"Abys" Wallace
  • 2
  • 2
5 Comments
 
LVL 9

Expert Comment

by:shorvath
ID: 38728498
Different versions of Outlook store Signature files in different places.  What version?
0
 

Author Comment

by:"Abys" Wallace
ID: 38728644
@shorvath... My apologies .. MS Outlook 2010  (Office 2010)
0
 
LVL 16

Accepted Solution

by:
terencino earned 500 total points
ID: 38728812
Hi abys757, attached is an update to your sample file.
To run it first copy the abys757.htm file attached to %userprofile%\AppData\Roaming\Microsoft\Signatures folder. It uses TextStream to bring in the signature HTML, just adding that as a string to the HTMLBody of the email
Let us know how it goes
...Terry
Sample-Workbook-2.xlsm
abys757.htm
0
 

Author Closing Comment

by:"Abys" Wallace
ID: 38729286
Hi Terry :)

Your solution worked but I had a quick question.  do I have to know each end user's signature file name (ex:  abys757.htm, on my home pc its:  main.htm) so could it change?  if so is there a way to easily find the signature file name. a way to go to the signatures folder and choose the saved signature...  Just a clarifying question.. Thank you for the solution!
0
 
LVL 16

Expert Comment

by:terencino
ID: 38730129
Hi abys757 yes that is not so easy! I build & distribute all our corporate signatures, so they have a simple naming convention, being username_New.htm and username_Reply.htm. So to retrieve these into the code, I pickup the username with Environ("username") and add it into the code as follows:
SigString = Environ("userprofile") & _
     "\AppData\Roaming\Microsoft\Signatures\" & Environ("username") & "_New.htm"

Open in new window

Another option is to extract the hex from the registry, just look for New Signature or Reply-Forward Signature which are the defaults for new and reply/forward emails set in each users Outlook options. For example mine is buried deep at

HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\terencino\9375CFF0413111d3B88A00104B2A676\00000001

We use Office365, so it may be in a different location for you.

Yet another option might be to use FileSystemObject to cycle through the HTM files in the Signature folder, and present the user with a picklist or FileDialog so the can select the one they want. This might be more flexible as my users have up to 5 different signatures depending on the role and entity they are using at the time.

Let me know if your users have a pattern we can work with
...Terry
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question