Email Template Macro

rdifu

New Member
Joined
Feb 28, 2022
Messages
11
Office Version
  1. 365
Platform
  1. MacOS
Hello! I'm trying to make an excel macro and was wondering if anyone has already done this before. I have an email that I send out every week that is always formatted exactly the same with the same wording and the numbers in it just changes. Essentially kind of like a not as fun businessy mad libs. Each week the new numbers that go out are in the same place in a spreadsheet that I have and update. The goal is to run a macro that will create the email template and reference the cells with the numbers and add them in for me. I hope this makes sense, if anyone has done it before or is able to show me an example, I'd appreciate it a lot. Thank you!!
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
What "numbers" ? are you sending and "where do they go on your sheet" ? Do you want to provide an example of your workbook or what you perceive will be your layout ? Makes it a lot easier for us to provide you an answer.

VBA Code:
Option Explicit

Sub SndEmail()
Dim nConfirmation As Integer
Dim OutApp, OutMail As Object
Dim olMailItem

nConfirmation = MsgBox("Do you want to send an email notification about the sheet updating now?", vbInformation + vbYesNo, "Mail Sheet Updates")

    If nConfirmation = vbYes Then
        ActiveWorkbook.Save
        
        Set OutApp = CreateObject("Outlook.Application")
        Set OutMail = OutApp.CreateItem(olMailItem)
        
            With OutMail
                .To = "Test"
                .CC = ""
                .Subject = "Postnatal Urgent Spreadsheet Updated"
                .Body = "Hello, The Postnatal Urgent Slides Spreadsheet has been updated." & "   " & Range("B2").Value
                .Display
            End With
    End If
End Sub


REQUIRES SOME NUMBER IN B2
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,068
Messages
6,122,950
Members
449,095
Latest member
nmaske

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top