C
craigoutinoz
Hi All,
I have the below coding however it keeps returning a bug. I am adding
it to the tail end of an error trapping function. However I can't get
it working on it's own never mind at the end of the original coding.
The rest works fine, just not this bit. I want to send a newly saved
copy to a specific address, including ranges in the new saved name,
however I can't includ the date nor will it send.??
Can anyone help?
Thanks
Craig
Public Function Open_mail()
Application.ScreenUpdating = False
ActiveSheet.Copy
Set wb = ActiveWorkbook
With wb
.SaveAs ThisWorkbook.Name _
& " " & strdate & Range("B13").Value & Range("B14").Value
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
With OutMail
.To = "(e-mail address removed)"
.CC = ""
.BCC = ""
.Subject = "Credit Card Form" & Range("B13").Value &
Range("B14").Value
.Body = "This is a test... help!"
.Attachments.Add wb.FullName
'You can add other files also like this
'.Attachments.Add ("C:\test.txt")
'.Display
.Send 'or use .Display
End With
.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False
End With
Application.ScreenUpdating = True
Set OutMail = Nothing
Set OutApp = Nothing
End Function
I have the below coding however it keeps returning a bug. I am adding
it to the tail end of an error trapping function. However I can't get
it working on it's own never mind at the end of the original coding.
The rest works fine, just not this bit. I want to send a newly saved
copy to a specific address, including ranges in the new saved name,
however I can't includ the date nor will it send.??
Can anyone help?
Thanks
Craig
Public Function Open_mail()
Application.ScreenUpdating = False
ActiveSheet.Copy
Set wb = ActiveWorkbook
With wb
.SaveAs ThisWorkbook.Name _
& " " & strdate & Range("B13").Value & Range("B14").Value
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
With OutMail
.To = "(e-mail address removed)"
.CC = ""
.BCC = ""
.Subject = "Credit Card Form" & Range("B13").Value &
Range("B14").Value
.Body = "This is a test... help!"
.Attachments.Add wb.FullName
'You can add other files also like this
'.Attachments.Add ("C:\test.txt")
'.Display
.Send 'or use .Display
End With
.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False
End With
Application.ScreenUpdating = True
Set OutMail = Nothing
Set OutApp = Nothing
End Function