01-05-2011, 10:49 AM
(This post was last modified: 01-06-2011, 08:59 AM by kotaramamohana.)
Hi Friends,
i need to check the email notification(content) which was generated by application automatically.
i have used below mentioned code to check the email
Above code was working earlier perfectly that time we were using Xp, Outlook2000; but now I am using Windows7 and Outlook2003.
Now I am getting error as"The messaging interface has returned an unknown error. If the problem persists restart out look".
Even though after restarted outlook also same problem i am getting. I bolded the code where I got error.
Can u please share the solution if any one of know the solution.
My client is using Windows7, Outlook2007 here also its working fine.
i need to check the email notification(content) which was generated by application automatically.
i have used below mentioned code to check the email
Code:
'path of the updating contnet in the Excel file
strDataFileParam="D:\QTP_Razoo\"
'subject ine and sheet name
strParam="hprazoo15@sra.com] - 5 tips for making PRO2 FOR HP15 a huge success,PROPageCreation"
set olapp = createobject("outlook.application")
set inbox = olapp.getnamespace("mapi").folders
Set MyExcel = createobject("Excel.application")
Set MyFile=myExcel.workbooks.open (Mid(strDataFileParam,1,12) &"\RazooExcel.xls")
arrstrParam=Split(strParam,",")
for each fold in inbox
getsubfolders1(fold)
next
MyExcel.ActiveWorkbook.Save
myExcel.Quit
Set myExcel=Nothing
Sub getunreadmails1(objfolder)
Set col = objfolder.items
For each mail in col
If mail.unread then
strMailSub1=mail.subject
If Instr(strMailSub1,arrstrParam(0))>0 Then
strMailBody1=mail.body
MyFile.worksheets(arrstrParam(1)).Cells(2, 2)= strMailBody1
If MyFile.worksheets(arrstrParam(1)).Cells(2,1)= myFile.worksheets(arrstrParam(1)).Cells(2, 2) Then
MyFile.worksheets(arrstrParam(1)).Cells(2,3).value="Pass"
else
'Msgbox "Fail"
MyFile.worksheets(arrstrParam(1)).Cells(2,3).value="Fail"
End If
mail.unread=false
End if
end if
next
End Sub
Sub getsubfolders1(objparentfolder)
[b]set colfolders = objparentfolder.folders[/b]
For each objfolder in colfolders
set objsubfolder = objparentfolder.folders(objfolder.name)
if objfolder.name<>"notes" then
getunreadmails1 (objfolder)
end if
getsubfolders1(objsubfolder )
next
End Sub
Above code was working earlier perfectly that time we were using Xp, Outlook2000; but now I am using Windows7 and Outlook2003.
Now I am getting error as"The messaging interface has returned an unknown error. If the problem persists restart out look".
Even though after restarted outlook also same problem i am getting. I bolded the code where I got error.
Can u please share the solution if any one of know the solution.
My client is using Windows7, Outlook2007 here also its working fine.