happy holidays everyone, i hope the weather isn't too cold where you are.
i'm modifying a code i wrote early this year that creates an email based on a spreadsheet. i want the code to take the body of the open email and make that the body of an outlook task, take the subject of the open email, and make that the subject of the task, and then to save the task to a folder on my company's network drive. so far i have gotten pretty far, but with two small problems.
1. (and this is the problem i'm most concerned with) when i try to use the saveas command on my task i get the outlook security warning. i'm already using redemption to get the body of my open email, but i'm not sure how to use redemption (or if you can) to set the save path for my outlook task to avoid the security warning.
2. the method i'm using to get the body of my open email that is being written by the program saves a copy of the email as a draft, however, when the program finishes i want the email to be open (display) but i don't want the copy of the email in the drafts box. when i try to delete the email from the drafts box programmicaly it closes the open instance of the email as well.
below is the code:
sub createtasks()
Dim olTask As Outlook.TaskItem
Set olTask = OlApp.CreateItem(olTaskItem)
olTask.Subject = NewMail.Subject
NewMail.Save
redemptionTaskBody taskbody
olTask.Body = taskbody
olTask.DueDate = DateAdd("d", 21, Now)
olTask.Display
olTask.SaveAs ("I:\AutocadData\Temp\" + NewMail.Subject)'this line creates security warning
end sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub redemptionTaskBody(taskbody)
Dim OlApp As Outlook.Application
Dim sItem
Dim oitem As MailItem
Set OlApp = Outlook.Application
Set sItem = CreateObject("Redemption.SafeMailItem")
Set oitem = OlApp.Session.GetDefaultFolder(olFolderDrafts).Items(1) 'gets the first item in the drafts folder
sItem.Item = oitem
PrTaskBody = &H1000001E'gets the body of the object so i can set it to my task body
taskbody = sItem.Fields(PrTaskBody)
oitem.Delete'this line deletes the item in the drafts folder, but also closes the open instance of the email which i need to be open for the rest of my code
End Sub
any help would be greatly appreciated/
i'm modifying a code i wrote early this year that creates an email based on a spreadsheet. i want the code to take the body of the open email and make that the body of an outlook task, take the subject of the open email, and make that the subject of the task, and then to save the task to a folder on my company's network drive. so far i have gotten pretty far, but with two small problems.
1. (and this is the problem i'm most concerned with) when i try to use the saveas command on my task i get the outlook security warning. i'm already using redemption to get the body of my open email, but i'm not sure how to use redemption (or if you can) to set the save path for my outlook task to avoid the security warning.
2. the method i'm using to get the body of my open email that is being written by the program saves a copy of the email as a draft, however, when the program finishes i want the email to be open (display) but i don't want the copy of the email in the drafts box. when i try to delete the email from the drafts box programmicaly it closes the open instance of the email as well.
below is the code:
sub createtasks()
Dim olTask As Outlook.TaskItem
Set olTask = OlApp.CreateItem(olTaskItem)
olTask.Subject = NewMail.Subject
NewMail.Save
redemptionTaskBody taskbody
olTask.Body = taskbody
olTask.DueDate = DateAdd("d", 21, Now)
olTask.Display
olTask.SaveAs ("I:\AutocadData\Temp\" + NewMail.Subject)'this line creates security warning
end sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub redemptionTaskBody(taskbody)
Dim OlApp As Outlook.Application
Dim sItem
Dim oitem As MailItem
Set OlApp = Outlook.Application
Set sItem = CreateObject("Redemption.SafeMailItem")
Set oitem = OlApp.Session.GetDefaultFolder(olFolderDrafts).Items(1) 'gets the first item in the drafts folder
sItem.Item = oitem
PrTaskBody = &H1000001E'gets the body of the object so i can set it to my task body
taskbody = sItem.Fields(PrTaskBody)
oitem.Delete'this line deletes the item in the drafts folder, but also closes the open instance of the email which i need to be open for the rest of my code
End Sub
any help would be greatly appreciated/