How do you copy a task in outlook 209 code#
Ken can use the instructions from the original post to add the code to Outlook.As you know I have written 7 books on task management and email management. He also only wants to export active (i.e. Ken needs the recurrence pattern, recurrence range, and notes. I put this revision together for a reader named Ken who needs three fields added to the export. Corey needs to export both the Importance and Categories fieds, and he’d like to sort the exported tasks by Importance (descending) and Categories (ascending).Ĭorey will use the instructions from the original post to add the code to Outlook.ĮxcWks.Cells(lngRow, 13) = olkTsk.ImportanceĮxcWks.Cells(lngRow, 14) = olkTsk.CategoriesĮxcWks.Range("A1:N" & lngRow).Sort Key1:="Categories", Order1:=xlAscending, Key2:="Priority", Order2:=xlDescending, Header:=xlYes If you don’t want the macro to prompt for a file name each time, then you can change line 10 to strFilename = “Path_and_File_Name”Ī reader named Corey asked for a couple of modifications to the original code.To do that, change the headings written to the spreadsheet (lines 19-30) and the message fields (lines 36-47). This code can easily be modified to export a different set of fields.The dialog-box includes a count of the number of tasks exported. The macro will display a dialog-box when it’s finished.You can cancel the export by leaving the file name blank. When prompted, enter a file name to save the export to.With Outlook open select a folder that contains tasks.
![how do you copy a task in outlook 209 how do you copy a task in outlook 209](https://www.sharepointdiary.com/wp-content/uploads/2018/07/sharepoint-online-task-list-modern-experience.png)
A total of " & lngCnt & " tasks were exported.", vbInformation + vbOKOnly, SCRIPT_NAMEįunction GetDelegationState(intState As Integer) As Stringįunction GetOwnership(intState As Integer) As Stringįunction GetResponseState(intState As Integer) As String Remember to edit the column number you want each property to appear in.ĮxcWks.Cells(lngRow, 2) = olkTsk.CreationTimeĮxcWks.Cells(lngRow, 3) = olkTsk.StartDateĮxcWks.Cells(lngRow, 5) = olkTsk.DateCompletedĮxcWks.Cells(lngRow, 6) = olkTsk.PercentCompleteĮxcWks.Cells(lngRow, 7) = GetDelegationState(olkTsk.DelegationState)ĮxcWks.Cells(lngRow, 8) = olkTsk.DelegatorĮxcWks.Cells(lngRow, 10) = GetOwnership(olkTsk.Ownership)ĮxcWks.Cells(lngRow, 12) = GetResponseState(olkTsk.ResponseState) 'Add a row for each task item property you want to export. Set excApp = CreateObject("Excel.Application")įor Each olkTsk In Export aborted.", vbInformation + vbOKOnly, SCRIPT_NAME StrFilename = InputBox("Enter a filename (including path) to save the exported tasks to.", SCRIPT_NAME) Click the diskette icon on the toolbar to save the changesĬonst SCRIPT_NAME = "Export Tasks to Excel".Copy the code from the code snippet box and paste it into the right-hand pane of Outlook’s VB Editor window.Module1) by double-clicking on it or create a new module by right-clicking Modules and selecting Insert → Module. If not already expanded, expand Modules.If not already expanded, expand Microsoft Office Outlook Objects.Press ALT + F11 to open the Visual Basic Editor.Once again, you can refer to Microsoft’s documentation to see which properties are enumerated, the values in the enumeration, and what each value stands for.įollow these instructions to add the code to Outlook. There are other enumerated fields that would benefit from a similar conversion if you include them in your export. I only wrote those functions for enumerated fields I used in this example. Rather than exporting the numeric value stored in an enumerated property, I wrote functions that returns a more meaningful value in plain English. For example, a 0 in DelegationState means the task is not delegated, while a 2 means that the task has been delegated and the person it is delegated to has accepted it. An enumeration stores a numeric value that equates to something. DelegationState, Ownership) are enumerations.
![how do you copy a task in outlook 209 how do you copy a task in outlook 209](https://cdn.extendoffice.com/images/stories/doc-outlook/remove-hide-completed-tasks/doc-remove-hide-completed-tasks-1.png)
You can add, delete, and/or rearrange them to suit your needs. For this example, I’ve chosen a subset of task properties. Microsoft has pages on its site that list the complete set of a task item’s properties for Outlook 2007, Outlook 2010, and Outlook 2013. In order to change the script to handle a different item type, you need to know the properties of that item type.
![how do you copy a task in outlook 209 how do you copy a task in outlook 209](https://www.howtogeek.com/wp-content/uploads/2015/06/03_untitled_message.png)
![how do you copy a task in outlook 209 how do you copy a task in outlook 209](https://media.slipstick.com/images/2018/tasks/create-task-quick-step.png)
Where an email has properties called “Subject”, “ReceivedTime”, and “SenderEmailAddress” (to name a few), a task has “Subject”, “StartDate”, and “DueDate”. All Mitesh needs to do is change the list of item properties the code exports. appointments, contacts, messages, notes, tasks). In fact, you could adapt the code from the original post to export any of Outlook’s basic item types (i.e. Mitesh saw that post and asked if it’d be possible to adapt it to export Outlook tasks instead of messages. In an earlier post, I showed a number of ways to export Outlook messages to Excel.