01-09-2012, 01:03 AM
Hi,
I wrote a small piece of code to check unread mails in gmail.
try it.
I wrote a small piece of code to check unread mails in gmail.
try it.
Code:
Set excel = CreateObject("Excel.Application")
excel.Workbooks.Open("C:\gmail.xls")
Set sheet = excel.Sheets("Sheet1")
Set objLink = Description.Create()
objLink("html tag").value = "A"
Set objSearch = Browser("title:=Gmail.*").Page("title:=Gmail .*").ChildObjects(objLink)
row = 1
For i=35 to 84 'There are many links but mail (subject) link starts from index 35. Presuming that there are 50 mails per page
str = objSearch(i).getROProperty("innerhtml")
If instr(1,str ,"<B>",1)>0 Then 'identifies unread mail by checking whether the font is bold
sheet.cells(row,1) = objSearch(i).getROProperty("innertext") ' Writes the subject of unread emails in excelsheet from row.
row=row+1
j=j+1 'Counts total number of unread mails
End If
Next
excel.ActiveWorkbook.Save
excel.Quit
msgbox "You have " & j &" unread mail(s)"