Hey Guys,
I am still trying to find a way to have emails that are sent automatically save to a sub folder in outlook. I have pasted some of my code. I have searched the internet but I am not coming up with anything. Basically after I hit the "Pending Contracts" button an email is generated with an excel spreadsheet attached. After this is sent out to the individual I need it to be also be saved to a folder in Outlook. (For auditing purposes. Let me know if I need to display more information.
Thanks
sqlallemails = "SELECT * FROM Grouped_Emails;"
Set rs3 = db.OpenRecordset(sqlallemails)
While Not rs3.EOF
sqlemail = "SELECT Pending_Tbl.Account_Number, Pending_Tbl.Account_Name, Pending_Tbl.Primary_FA_num, Pending_Tbl.Branch, Pending_Tbl.New_Subcategory_ID, Pending_Tbl.DT_Code_Changed, Pending_Tbl.DT_Contract_Received "
sqlemail = sqlemail & "FROM Pending_Tbl "
sqlemail = sqlemail & "WHERE Pending_Tbl.Email='" & rs3.Fields(0) & "';"
qry.SQL = sqlemail
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Pending_Accounts", "C:\Pending_Contracts.xls", True
Set email = oLook.CreateItem(0)
With email
.To = rs3.Fields(0)
.Subject = "ATTENTION: Pending AMS Contract(s)"
.Attachments.Add "C:\Pending_Contracts.xls"
.HTMLBody = "Text text text<br><br>text text text"
'.Display
.Send
'.Move ("mydestfolder")
End With
rs3.MoveNext
Wend
End Sub