Hi, I have a workbook that I would like to save a copy in a particular folder with naming.
I would then like to email it, and then close the file.
I have used the below macro for this, however users are receiving an error on line:
when using this workbook.
Could you please assist me with what is wrong with this code?
Thank you, C
I would then like to email it, and then close the file.
I have used the below macro for this, however users are receiving an error on line:
Code:
With Destwb
.SaveAs TempFilePath & TempFileName & FileExtStr, FileFormat:=FileFormatNum
Could you please assist me with what is wrong with this code?
Thank you, C
Code:
'Save the new workbook/Mail it/Delete it TempFilePath = "\\10.1.1.0\Data\#Change Requests\01.Unapproved" & "\"
TempFileName = "Pricing Request " & Format(Now, "dd-mmm-yy hh-mm")
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With Destwb
.SaveAs TempFilePath & TempFileName & FileExtStr, FileFormat:=FileFormatNum
On Error Resume Next
With OutMail
.to = "someone@email.com"
.CC = ""
.BCC = ""
.Subject = "New Price Request : " & Format(Now, "dd-mmm-yy hh-mm")
.Body = "Please find attached new Price Request."
.Attachments.Add Destwb.FullName
.Send
End With
On Error GoTo 0
.Close savechanges:=False
End With