Hi,
I have created a code in excel to create an email with a link and paste a screenshot within the email but im having trouble pasting the screenshot below the email body (ideally i would like it a line below the hyperlink, probably a stupid question but is there a way to ammend the code so the screenshot is pasted below the hyperlink?
Thank you in advance, please see code below:
I have created a code in excel to create an email with a link and paste a screenshot within the email but im having trouble pasting the screenshot below the email body (ideally i would like it a line below the hyperlink, probably a stupid question but is there a way to ammend the code so the screenshot is pasted below the hyperlink?
Thank you in advance, please see code below:
VBA Code:
Sub Compose_Email_TEST()
'Optimize Macro Speed
Application.ScreenUpdating = False
Application.EnableEvents = False
Application.Calculation = xlCalculationManual
Dim Wb1 As Workbook
Set Wb1 = ThisWorkbook
'back to the first sheet
ThisWorkbook.Sheets(1).Select
'get the name shown in the upper right hand corner of Excel to use as the signature
Dim OwnerName As String
OwnerName = Application.UserName
'get the workbook name
Dim WorkbookName As String
WorkbookName = Wb1.Name
'get the location where the spreadsheet is saved
Dim FileLoc As String
FileLoc = Wb1.FullName
'time to start Mircosoft Outlook if it hasn't already been started
Dim xOutApp As Object
Dim xOutMail As Object
Dim xMailBody As String
On Error Resume Next
Set xOutApp = CreateObject("Outlook.Application")
Set xOutMail = xOutApp.CreateItem(0)
'for non-html email
'xMailBody = "Team, " & vbNewLine & vbNewLine & "Please check and sign this DCN:" & vbNewLine & "Thanks," & vbNewLine & OwnerName
'for html email. This is the body of the email
xMailBody = "Hi All, <br><br>" & "BS1495 Funding is ready for auth:" & "<br><br>" & _
"<a href=" & Chr(34) & FileLoc & Chr(34) & " > " & WorkbookName & " </a> " _
& "<br><br>" & "Thanks," & "<br><br>" & OwnerName
'fill in each section of the newly created email message
On Error Resume Next
With xOutMail
.To = "controlevidence.finops@landg.com"
.CC = ""
.BCC = ""
.Subject = WorkbookName
'.Body = xMailBody
.HTMLBody = xMailBody
.Display 'or use .Send
Application.SendKeys "(^v)"
End With
On Error GoTo 0
Set xOutMail = Nothing
Set xOutApp = Nothing
'Reset Macro Optimization Settings
Application.EnableEvents = True
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub