Current location - Quotes Website - Personality signature - How to use a macro to send an email in Outlook and use an existing signature?
How to use a macro to send an email in Outlook and use an existing signature?

There are some emails that need to be sent frequently at work, but the patterns are relatively similar.

For example: daily email

The recipient, subject, and signature are basically the same, except that the date in the subject needs to be changed

Everything else can use a template to achieve.

Just write a VBA function to complete this task.

Practice found that Outlook does not support macro recording, which caused some trouble.

After searching on the Internet, I found the code for sending emails through VBA programming as follows: 'New email Set OutApp = CreateObject("Outlook.Application") 'Create an outlook object

OutApp .Session.Logon 'Log in to MAPI

Set OutMail = OutApp.CreateItem(olMailItem) 'Create a new mail object

'Set the mail title, recipients, etc.

< p>With OutMail

.To = strTo'To

.CC = strCC'Cc

.BCC = ""

< p>.Subject = strSubject'Subject

The subject can read the current date

mDate = Format(Now, "yyyy-MM-dd")

strSubject="[Daily]" & mDate

When executing this macro, an email with the current date title has been generated and is waiting to be sent