10-11-2010, 11:17 AM
(This post was last modified: 10-11-2010, 11:19 AM by kotaramamohana.)
Hi Friends,
I have an issue in the email checking, and i have given the error below. And has also attached the code i used. If i am not declaring the variables its working perfectly, if i use this in the framework it throws error. Please help me to resolve this issue.
---------
Error:
---------
The operation failed. An object could not be found.
Line (63):
----------------------------------------
Regards,
Ram
I have an issue in the email checking, and i have given the error below. And has also attached the code i used. If i am not declaring the variables its working perfectly, if i use this in the framework it throws error. Please help me to resolve this issue.
---------
Error:
---------
The operation failed. An object could not be found.
Line (63):
Code:
"set objsubfolder = objparentfolder.folders(objfolder.name)".
----------------------------------------
Code:
Option Explicit
Dim olapp,inbox,fold,colfolders,objfolder,objsubfolder,objparentfolder,mail,col,strMailSub1,strMailSub2,strMailBody1,strMailBody2,strMailBody3
Call fnResetPassword()
Public Function fnResetPassword()
set olapp = createobject("outlook.application")
set inbox = olapp.getnamespace("mapi").folders
for each fold in inbox
'msgbox fold.name
'If fold="Razoo Mails" Then
getsubfolders(fold)
'End If
next
'msgbox inbox.count
End Function
sub getunreadmails(objfolder)
set col = objfolder.items
for each mail in col
If mail.unread then
strMailSub1=mail.subject
strMailSub2=split(strMailSub1,"-")
If Trim(strMailSub2(1))="Password reset request" Then
'datatable.SetCurrentRow i
'msgbox mail.subject
'datatable.Value("Subject","Global")=mail.subject
'msgbox mail.sendername
'msgbox mail.body
strMailBody1=mail.body
strMailBody2=split(strMailBody1,"http://")
strMailBody3=split(Trim(strMailBody2(1)),"edit")
'Datatable.Value("Expected","SubDriver[SubDriver]")=Trim(strMailBody3(0))&"edit"
strResetUrl=Trim(strMailBody3(0))&"edit"
'Msgbox "http//" &z(0) &"/edit"
msgbox strResetUrl
'msgbox mail.senton
mail.unread=false
End if
end if
next
end sub
sub getsubfolders(objparentfolder)
set colfolders = objparentfolder.folders
'msgbox colfolders.count
For each objfolder in colfolders
'msgbox objfolder.name
set objsubfolder = objparentfolder.folders(objfolder.name)
msgbox objsubfolder.name
if objfolder.name<>"notes" then
getunreadmails(objfolder)
end if
getsubfolders objsubfolder
next
end sub
Regards,
Ram