Hi,
I have columns on "healthcheck" sheet that gets updated daily, with the latest update on the last blank column. I am then trying to locate the last filled column and copy paste it to a separate sheet "export" so that I can select the range and have it go out as part of an email.
But for some reason my rPort variable returns just "true" as part of the mail body.
&
the From function breaks the code
Where have I gone wrong?
I have columns on "healthcheck" sheet that gets updated daily, with the latest update on the last blank column. I am then trying to locate the last filled column and copy paste it to a separate sheet "export" so that I can select the range and have it go out as part of an email.
But for some reason my rPort variable returns just "true" as part of the mail body.
&
the From function breaks the code
Where have I gone wrong?
Code:
Sub Macro1()
Sheets("HealthCheck").Select 'Reselect page
Range("A1").Select
Selection.End(xlToRight).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("Export").Select
Range("B1").Select
ActiveSheet.Paste
rPort = ActiveSheet.Range("A1:B4").Select 'range selection on Export sheet
Dim tDate As String
Dim OutApp As Object
Dim OutMail As Object
tDate = Format(DateTime.Now, "dd mmmm yyyy hh:mm") 'Format Today's date for filename
Application.ScreenUpdating = True 'Turn on screenupdating
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
.Display
End With
Signature = OutMail.Body
With OutMail
'.From = "me@me.com"
.To = "you@you.com"
.Subject = " HealthCheck Report " & tDate
.HTMLBody = "<p class=MsoNormal> <Span style='font-size:11.0pt'>Hi , <br><br>Platform HealthCheck report:" & rPort & " </Span></p> " & .HTMLBody
MsgBox ("Your HealthCheck Report is now ready to be sent to OPS.") 'Display a message box outlining end of script
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub