Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dim wb1 As Workbook
- Dim TempFilePath As String
- Dim TempFileName As String
- Dim FileExtStr As String
- Dim OutApp As Object
- Dim OutMail As Object
- With Application
- .ScreenUpdating = False
- .EnableEvents = False
- End With
- Set wb1 = ActiveWorkbook
- TempFilePath = Environ$("temp") & ""
- TempFileName = Range("H22") & wb1.Name & " " & Format(Now, "dd-mmm-yy h-mm-ss")
- FileExtStr = "." & LCase(Right(wb1.Name, Len(wb1.Name) - InStrRev(wb1.Name, ".", , 1)))
- wb1.SaveCopyAs TempFilePath & TempFileName & FileExtStr
- Set OutApp = CreateObject("Outlook.Application")
- Set OutMail = OutApp.CreateItem(0)
- On Error Resume Next
- With OutMail
- .to = "person1@PLACE.COM"
- .CC = "MPERSON@PLACE.COM" & " " & "LPERSON@PLACE.COM"
- .BCC = ""
- .Subject = "SUBJECT" & Range("H22")
- .Body = "Please review ETC.ETC."
- .Attachments.Add TempFilePath & TempFileName & FileExtStr
- .Display
- End With
- On Error GoTo 0
- Dim myFile As String
- myFile = ActiveWorkbook.Name
- Application.DisplayAlerts = False ' Disregard overwriting message.
- ActiveWorkbook.SaveAs Filename:="U:PublicWAKKAWAKKAWAKKA - To Review"
- Kill TempFilePath & TempFileName & FileExtStr
- Set OutMail = Nothing
- Set OutApp = Nothing
- With Application
- .ScreenUpdating = True
- .EnableEvents = True
- End With
- Call SaveFileExcel
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement