Show Buttons
Share On Facebook
Share On Twitter
Share On Google Plus
Share On Linkdin
Share On Reddit
Contact us
Hide Buttons

Send Mail With Link to a Workbook, From MS Outlook using Excel.

In ear­lier post you have learned  Send Mail with Embed­ded Image in mes­sage body From MS Out­look. In this arti­cle we will learn about how to Send Mail With a link in a Mes­sage body to a Excel Work­book From MS Out­look using Excel.

I would rec­om­mend that you must read Send a Sim­ple Mail From MS Out­look Using Excel and Send Mail with Embed­ded Image in mes­sage body From MS Out­look to under­stand the com­plete code below.

Com­plete Code:

Sub sumit()
Dim mainWB As Workbook
Dim SendID
Dim CCID
Dim Subject
Dim Body
Dim olMail As MailItem

Set otlApp = CreateObject("Outlook.Application")
Set olMail = otlApp.CreateItem(olMailItem)
Set Doc = olMail.GetInspector.WordEditor
'Dim colAttach As Outlook.Attachments
Dim oAttach As Outlook.Attachment

Set mainWB = ActiveWorkbook

SendID = mainWB.Sheets("Mail").Range("B1").Value
CCID = mainWB.Sheets("Mail").Range("B2").Value
Subject = mainWB.Sheets("Mail").Range("B3").Value
Link = mainWB.Sheets("Mail").Range("B4").Value
Body = mainWB.Sheets("Mail").Range("B5").Value
With olMail
    .To = SendID
    If CCID <> "" Then
      .CC = CCID
    End If
    .Subject = Subject
    .HTMLBody = Body & "<A HREF=""file://" & Link & _
                  """>Click me open the file</A>" & _
                  "<br><br>Regards," & _
                  "<br><br>Sumit Jain</font>"
    .Display
    .Send
End With
MsgBox ("you Mail has been sent to " & SendID)
End Sub

Sub browse()
    Dim FSO As Object
    Dim blnOpen
    strFileToOpen = Application.GetOpenFilename(Title:="Please choose a file to open", _
    FileFilter:="Excel Files *.xls* (*.xls*),")
    If strFileToOpen = False Then
      MsgBox "No file selected.", vbExclamation, "Sorry!"
      Exit Sub
    Else
        Sheet1.Range("B4").Value = strFileToOpen
    End If
End Sub

Send Mail With Link to a Workbook, From MS Outlook  - Mail
Send Mail With Link to a Workbook, From MS Outlook  - Output

 

Send Mail With Link to a Workbook, From MS Outlook  - Open excel 2

 

 

Send Mail With Link to a Workbook, From MS Outlook  - Open excel 3

 

Send Mail With Link to a Workbook, From MS Outlook  - Open excel

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: