- 
	
	
		
		
			
				
				
				
					
 Import Outlook-Taks in an Excel-Sheet
				
				
						
						
				
					
						
							Hey guys,
I would like to import Information of Outlook-Tasks in an Excel-Sheet.
Therefor the Marco should do the following things:
1. Open a Listbox, which shows alle TaskFolders of Outlook as a List.
2. The User marks the List he wants and presses "OK"
3. Following Information of all the tasks in the selected List will be importet in the Excel-Sheet in, for every task in a new Row : Subject, CreationTime, DueDate, Body and Complete.
Would be great, if someone can help me. I'm quite new in VBA.
The only thing I have so far is th code below.
My biggest problem is showing the box with all the Task-Lists and selecting one of them.
Thank you so much.
Cheers,
Pascal
Sub GetOLTasks()
Dim OL As Outlook.Application, objFolder As Outlook.MAPIFolder
Dim objTask As Outlook.TaskItem, objRecipient As Outlook.Recipient, objAction As Outlook.Action
Dim objSheet As Excel.Worksheet
Dim i As Long, S As String
 
On Error GoTo Fehler
 
    Set OL = CreateObject("Outlook.Application")
    Set objFolder = OL.GetNamespace("MAPI").GetDefaultFolder(olFolderTasks)
'Missing part for opening a ListBox with all the TaskFolders as content to select
    Set objSheet = Application.Worksheets(3)
    
    With objSheet
        .Cells.Clear
        .Cells(1, 1) = "Subject"
        .Cells(1, 2) = "CreationTime"
        .Cells(1, 3) = "DueDate"
        .Cells(1, 4) = "Body"
        .Cells(1, 5) = "Complete"
    End With
    i = 2
    For Each objTask In objFolder.Items
        With objSheet
            .Cells(i, 1) = objTask.Subject
            .Cells(i, 2) = objTask.CreationTime
            .Cells(i, 3) = objTask.DueDate
            .Cells(i, 4) = objTask.Body
            .Cells(i, 5) = objTask.Complete
        End With
        i = i + 1
    Next objTask
 
Ende:
    Set objFolder = Nothing
    Set objTask = Nothing
    Set objSheet = Nothing
    Set OL = Nothing
    Exit Sub
 
Fehler:
    MsgBox Err.Description
    Resume Ende
End Sub
						
					 
					
				 
			 
			
			
		 
	 
		
	
 
		
		
		
	
 
	
	
	
	
	
	
	
	
	
	
	
	Tags for this Thread
	
	
	
		
		
			
				
				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