richardtims
New Member
- Joined
- Jun 25, 2018
- Messages
- 31
Hello,
I am still somewhat new to the VBA coding, but I have learned an extreme amount in the past few months. The background of what I am needing to accomplish is to send reports based on whether I have updated the report. I have already figured out how to make the email get the subject, email address, path, and file name from the appropriate fields which has been challenging.
I am having 2 small issues however. First issue is I am trying to get my default Outlook email signature to be included in my emails that I am generating. I do need to I would prefer to use the .send over the .display if possible.
My second issue is setting up the macro to look at Column A to determine whether or not to send the email to that row of information. I want the macro to look at column A for as many lines are there (Currently 10 rows) and if the cell in column A is blank, I want it to send an email. If it has anything else like an "x", I want it to skip over that row and proceed to the next.
If this is covered in a different thread, please let me know. I have spent hours upon hours searching for a solution that I can implement without breaking what I have worked on so far.
I have pasted my code below. Please forgive me if there is unnecessary coding or missing coding. This is still somewhat new to me and any help is appreciated.
Sub MailReports()
Dim rng As Range
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
Set ws = Sheets("Sheet1")
With OutMail
.To = ActiveSheet.Range("D4")
.CC = ""
.BCC = ""
.subject = Range("C4").Value
.Attachments.Add Range("E4").Value & "" & Range("F4").Value & Range("G4").Value
.Body = ""
.Display 'would prefer .Send instead of .Display
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
I am still somewhat new to the VBA coding, but I have learned an extreme amount in the past few months. The background of what I am needing to accomplish is to send reports based on whether I have updated the report. I have already figured out how to make the email get the subject, email address, path, and file name from the appropriate fields which has been challenging.
I am having 2 small issues however. First issue is I am trying to get my default Outlook email signature to be included in my emails that I am generating. I do need to I would prefer to use the .send over the .display if possible.
My second issue is setting up the macro to look at Column A to determine whether or not to send the email to that row of information. I want the macro to look at column A for as many lines are there (Currently 10 rows) and if the cell in column A is blank, I want it to send an email. If it has anything else like an "x", I want it to skip over that row and proceed to the next.
If this is covered in a different thread, please let me know. I have spent hours upon hours searching for a solution that I can implement without breaking what I have worked on so far.
I have pasted my code below. Please forgive me if there is unnecessary coding or missing coding. This is still somewhat new to me and any help is appreciated.
Sub MailReports()
Dim rng As Range
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
Set ws = Sheets("Sheet1")
With OutMail
.To = ActiveSheet.Range("D4")
.CC = ""
.BCC = ""
.subject = Range("C4").Value
.Attachments.Add Range("E4").Value & "" & Range("F4").Value & Range("G4").Value
.Body = ""
.Display 'would prefer .Send instead of .Display
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub