CarlStephens
Board Regular
- Joined
- Sep 25, 2020
- Messages
- 128
- Office Version
- 2016
- Platform
- Windows
Hello All,
I am getting a compile error on the .Rows. with "Invalid or Unqualified Reference" and I am not too sure what he fix is, as it looks ok to me but clearly it is not. The xMailBody code should go to cell C11 and anything typed in this cell and any other cells after C11 will be copied and pasted into the body of the email. Any help will be greatly appreciated. Thank you.
I am getting a compile error on the .Rows. with "Invalid or Unqualified Reference" and I am not too sure what he fix is, as it looks ok to me but clearly it is not. The xMailBody code should go to cell C11 and anything typed in this cell and any other cells after C11 will be copied and pasted into the body of the email. Any help will be greatly appreciated. Thank you.
Rich (BB code):
Sub Send_Single_Email()
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)
xMailBody = Join(Application.Transpose(.Range("C11", .Cells(.Rows.Count, "C").End(xlUp)).Value), vbCrLf)
On Error Resume Next
With xOutMail
.To = .Range("C2").Value
.CC = .Range("C3").Value
.BCC = .Range("C4").Value
.Subject = .Range("C5").Value
.Attachments.Add = .Range("C7").Value
.Display
End With
On Error GoTo 0
Set xOutMail = Nothing
Set xOutApp = Nothing
End Sub
Last edited by a moderator: