ram567
08-10-2010, 02:44 PM
Hi!
i have the code below which check sendername in outlook to sendername in excel.
if matches it grabs the informaiton received time into excel
i have error in subscript out of range
" Set c = .Find(olItem.SenderName, LookIn:=xlValues, LookAt:=xlPart _, SearchOrder:=SearchOrder, SearchDirection:=SearchDirection, MatchCase:=False _ , SearchFormat:=False) "
could anybody help me.
Dim lResult As Long, oRg As Range
Dim SearchDirection As XlSearchDirection
j = Sheets("Sheet1").Range("A65536").End(xlUp).Row +1
' j = 6
For Each olItem In Fldr.Items
If olItem.To = "xxx" Or olItem.To = "xxx" Or olItem.To = "xxx" Then
If Mid(olItem.Subject, 5, 8) = "Password " Then
With ActiveSheet.Range("A6:A" & j)
Set c = .Find(olItem.SenderName, LookIn:=xlValues _ , LookAt:=xlPart, SearchOrder:=SearchOrder, SearchDirection:=SearchDirection _, MatchCase:=False, SearchFormat:=False)
If Not c Is Nothing Then
Result = c.Row
' pFindRowPos = lResult
ActiveSheet.Cells(Result, 3).Value = olItem.ReceivedTime
End If
End With
End If
j = j +1
End If
Next olItem
i have the code below which check sendername in outlook to sendername in excel.
if matches it grabs the informaiton received time into excel
i have error in subscript out of range
" Set c = .Find(olItem.SenderName, LookIn:=xlValues, LookAt:=xlPart _, SearchOrder:=SearchOrder, SearchDirection:=SearchDirection, MatchCase:=False _ , SearchFormat:=False) "
could anybody help me.
Dim lResult As Long, oRg As Range
Dim SearchDirection As XlSearchDirection
j = Sheets("Sheet1").Range("A65536").End(xlUp).Row +1
' j = 6
For Each olItem In Fldr.Items
If olItem.To = "xxx" Or olItem.To = "xxx" Or olItem.To = "xxx" Then
If Mid(olItem.Subject, 5, 8) = "Password " Then
With ActiveSheet.Range("A6:A" & j)
Set c = .Find(olItem.SenderName, LookIn:=xlValues _ , LookAt:=xlPart, SearchOrder:=SearchOrder, SearchDirection:=SearchDirection _, MatchCase:=False, SearchFormat:=False)
If Not c Is Nothing Then
Result = c.Row
' pFindRowPos = lResult
ActiveSheet.Cells(Result, 3).Value = olItem.ReceivedTime
End If
End With
End If
j = j +1
End If
Next olItem