I have Outook 2010. I need a macro to take my task, make a copy of it and then move the COPY into another task folder.
I have everything working except it moved the original task into the folder and not the copy of the task.
Here is my code:
'Check how many items need to create tasks
Select Case TypeName(Outlook.Application.ActiveWindow)
Dim objItem As Object
For Each objItem In Outlook.Application.ActiveExplorer.Selection
Sub CreateTaskfromObject(objItem As Object)
' NOTE - This code uses CopyTaskDDS
Dim objTask As Outlook.TaskItem
Select Case objItem.Class
' Duplicate the task (DDS)
Dim objMainTask As TaskItem
Set objTask = Application.CreateItem(olTaskItem)
Set objMainTask = objItem
Set objTask = objMainTask.Copy
.Subject = "DDS of " & .Subject
'Move the Task
Dim Ns As Outlook.NameSpace
Dim oApp As Outlook.Application
Dim oTask As Outlook.TaskItem
Dim moveTo As Outlook.Folder
Set Ns = Application.GetNamespace("MAPI")
Set oApp = Outlook.Application
'If task is open, this will move the task to a subfolder of the default tasks folder:
Set oTask = oApp.ActiveInspector.CurrentItem
Set moveTo = Ns.GetDefaultFolder(olFolderTasks).Folders("DDS Tasks")
I realize the reason it's moving the original task item is because of my code "Set oTask = oApp.ActiveInspector.CurrentItem", but I'm not sure what to code to tell it to move the Copied Task Item.
Can anyone assist me.
Thank you in advance.