Thought I had a fix but not working.
Have a spread sheet that employees fill out and click a button to sent to an email address, then clear a range of cells that the employee just filled out so the form is blank for the next person to fill out.
My issue is that the email comes in with blank or no information filled in. It is blanking out or clearing the spread sheet that is sent in the email. I want the woorkbook that is being sent in the email to have the info in it that was filled out by the employee, but after the workbook is sent then clear the spread sheet so it is blank for the next person.
Any help would be appreciated, Thanks!
See attached code:
Sub SendMail()
Dim olApp As Outlook.Application
Dim olMail As Outlook.MailItem
On Error Resume Next
Set olApp = GetObject(, "Outlook.Application")
If Err.Number <> 0 Then
Set olApp = CreateObject("Outlook.Application")
Err.Clear
End If
On Error GoTo 0
Set olMail = olApp.CreateItem(olMailItem)
With olMail
.Subject = "Please Enter Consignment Transactions ASAP"
.To = Range("AA1")
.CC = Range("AB1")
.Attachments.Add ThisWorkbook.FullName
.Body = "Please Enter Consignment Transactions ASAP"
.Send
Range("B10:H31").Value = ""
MsgBox _
prompt:="Your Form Has Been Sent", _
Buttons:=vbOKOnly, _
Title:="Consignment Transfer"
End With
End Sub
Bookmarks