RavosJ
New Member
- Joined
- Aug 27, 2019
- Messages
- 8
Hi all,
I was able to create a macro that allows me, with the push of a button, to send he Excel file to a certain address.
Sub Mod_SendWorkbook()
Dim OutlookApp As Object
Dim OutlookMail As Object
Set OutlookApp = CreateObject("Outlook.Application")
Set OutlookMail = OutlookApp.CreateItem(0)
On Error Resume Next
With OutlookMail
.To = "xxx@gmail.com"
.CC = ""
.BCC = ""
.Subject = Range("D7").Text
.Body = "Please check attached file, thank you."
.Attachments.Add Application.ActiveWorkbook.FullName
.Send
End With
Set OutlookMail = Nothing
Set OutlookApp = Nothing
End Sub
However when I want to fine tune it a bit more:
-I would like it to only sent out I a certain range is filled in
-To display an error message which field is missing
-To display a certain message if it was sent successfully.
I keep struggling to combine any further code with the basic one...
Any help or direction would be greatly appreciated!
Thanks in advance.
I was able to create a macro that allows me, with the push of a button, to send he Excel file to a certain address.
Sub Mod_SendWorkbook()
Dim OutlookApp As Object
Dim OutlookMail As Object
Set OutlookApp = CreateObject("Outlook.Application")
Set OutlookMail = OutlookApp.CreateItem(0)
On Error Resume Next
With OutlookMail
.To = "xxx@gmail.com"
.CC = ""
.BCC = ""
.Subject = Range("D7").Text
.Body = "Please check attached file, thank you."
.Attachments.Add Application.ActiveWorkbook.FullName
.Send
End With
Set OutlookMail = Nothing
Set OutlookApp = Nothing
End Sub
However when I want to fine tune it a bit more:
-I would like it to only sent out I a certain range is filled in
-To display an error message which field is missing
-To display a certain message if it was sent successfully.
I keep struggling to combine any further code with the basic one...
Any help or direction would be greatly appreciated!
Thanks in advance.