-
exporting tasks from shared inbox
Hi guys. I've created the following code which will export my tasks to excel:
[VBA]Sub export_tasks()
'DECLARE VARIABLES
Dim strReport As String
Dim olnameSpace As Outlook.NameSpace
Dim taskFolder As Outlook.MAPIFolder
Dim tasks As Outlook.Items
Dim tsk As Outlook.TaskItem
Dim objExcel As New Excel.Application
Dim exWb As Excel.Workbook
Dim sht As Excel.Worksheet
Dim strMyName As String
Dim x As Integer
Dim y As Integer
'REMOVE EXISTING DATA
Set exWb = objExcel.Workbooks.Open("c:\systems\tasks\task.xls")
exWb.Sheets("Sheet1").range("A1:H2500").Select
exWb.Sheets("Sheet1").range("A1:H250").ClearContents
'REFERENCE WORKBOOKS
Set olnameSpace = Application.GetNamespace("MAPI")
Set taskFolder = olnameSpace.GetDefaultFolder(olFolderTasks)
Set tasks = taskFolder.Items
strReport = ""
'CREATE THE HEADER
exWb.Sheets("Sheet1").Cells(1, 1) = "Subject"
exWb.Sheets("Sheet1").Cells(1, 2) = "Start Date"
exWb.Sheets("Sheet1").Cells(1, 3) = "Due Date"
y = 2
For x = 1 To tasks.Count
Set tsk = tasks.Item(x)
'FILL IN THE DATA
If Not tsk.Sensitivity = olPrivate Then
'Add the data
exWb.Sheets("Sheet1").Cells(y, 1) = tsk.Subject
exWb.Sheets("Sheet1").Cells(y, 2) = tsk.StartDate
exWb.Sheets("Sheet1").Cells(y, 3) = tsk.DueDate
y = y + 1
End If
Next x
'SAVE AND CLOSE
exWb.Save
exWb.Close
Set exWb = Nothing
End Sub
[/VBA]
I also have a shared mailbox, can anyone tell me how to export tasks from that? I thought having the code to do it already that it would be easy enough but i can't work it out.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules