Hello everyone, I could use a fresh set of eyes on the below procedure. I outlined the line that seems to be giving trouble. What is happening is when it reaches the PropDescrip line it just stops with no error, even when I step through it. The wierd part is that it puts the information for PropDescrip and the following line into the spreadsheet, even though when stepping thru it it does not appear to do so?
Using Outlook 2002 & Excel 2002 and the procedure is in a Outlook Module.
Any advice or help is greatly appreciated.
Sub GetTaskItems()
Dim objWS As Excel.Worksheet
Dim objApp As Outlook.Application
Dim objNS As NameSpace
Dim CISTaskItems As MAPIFolder
Dim CISTask As Outlook.TaskItem
Dim PropDescrip As UserProperty 'used for accessing custom fields
Dim PropReportSent As UserProperty
Dim i As Integer
On Error GoTo Err_Handler
'UserProperty: Added Custom Fields by User
'Importance = Priority: 0 = Low, 1 = Normal, 2 = High
'Categories: Item(s) that is IN (Error, Would Like, Problem, Correction)
'Owner: Will Cause Security Alert When accessing Owner Attributes
'Status: 0 = Not Started, 1 = In Progress, 2 = Completed, 3 = Waiting On Someone Else, 4 = Deferred
'reference the folder to work with
Set objNS = Application.GetNamespace("MAPI")
Set CISTaskItems = objNS.GetDefaultFolder(olFolderTasks)
Set objWS = GetExcelWS() 'function for returning excel workbook to put data in
'Loop through all Tasks in Tasks Folder
For Each CISTask In CISTaskItems.Items
Set PropDescrip = CISTask.UserProperties("Description")
Set PropReportSent = CISTask.UserProperties("Report Sent")
If CISTask.Status = olTaskComplete Then
If PropReportSent = False Then
objWS.Range("A1").Offset(i, 0) = CISTask.Importance
objWS.Range("B1").Offset(i, 0) = CISTask.Owner
objWS.Range("C1").Offset(i, 0) = CISTask.ContactNames
objWS.Range("D1").Offset(i, 0) = CISTask.Status
objWS.Range("E1").Offset(i, 0) = CISTask.Categories
'####BUGGING OUT HERE
objWS.Range("F1").Offset(i, 0) = PropDescrip
'#######
objWS.Range("G1").Offset(i, 0) = CISTask.DateCompleted
PropReportSent = True
i = i + 1
End If
End If
Next
Exit Sub
Err_Handler:
MsgBox Err.Source & Space(1) & Err.Description
End Sub
Using Outlook 2002 & Excel 2002 and the procedure is in a Outlook Module.
Any advice or help is greatly appreciated.
Sub GetTaskItems()
Dim objWS As Excel.Worksheet
Dim objApp As Outlook.Application
Dim objNS As NameSpace
Dim CISTaskItems As MAPIFolder
Dim CISTask As Outlook.TaskItem
Dim PropDescrip As UserProperty 'used for accessing custom fields
Dim PropReportSent As UserProperty
Dim i As Integer
On Error GoTo Err_Handler
'UserProperty: Added Custom Fields by User
'Importance = Priority: 0 = Low, 1 = Normal, 2 = High
'Categories: Item(s) that is IN (Error, Would Like, Problem, Correction)
'Owner: Will Cause Security Alert When accessing Owner Attributes
'Status: 0 = Not Started, 1 = In Progress, 2 = Completed, 3 = Waiting On Someone Else, 4 = Deferred
'reference the folder to work with
Set objNS = Application.GetNamespace("MAPI")
Set CISTaskItems = objNS.GetDefaultFolder(olFolderTasks)
Set objWS = GetExcelWS() 'function for returning excel workbook to put data in
'Loop through all Tasks in Tasks Folder
For Each CISTask In CISTaskItems.Items
Set PropDescrip = CISTask.UserProperties("Description")
Set PropReportSent = CISTask.UserProperties("Report Sent")
If CISTask.Status = olTaskComplete Then
If PropReportSent = False Then
objWS.Range("A1").Offset(i, 0) = CISTask.Importance
objWS.Range("B1").Offset(i, 0) = CISTask.Owner
objWS.Range("C1").Offset(i, 0) = CISTask.ContactNames
objWS.Range("D1").Offset(i, 0) = CISTask.Status
objWS.Range("E1").Offset(i, 0) = CISTask.Categories
'####BUGGING OUT HERE
objWS.Range("F1").Offset(i, 0) = PropDescrip
'#######
objWS.Range("G1").Offset(i, 0) = CISTask.DateCompleted
PropReportSent = True
i = i + 1
End If
End If
Next
Exit Sub
Err_Handler:
MsgBox Err.Source & Space(1) & Err.Description
End Sub