Automate rediffmail.com & select attachment

ganesh25

New Member
Joined
Jan 30, 2011
Messages
8
Hi,

This code works after the we login to rediffmail.com webpage then I have clicked on new mail entered the details that is to, cc, subject.
Please login to rediffmail then click on Classic view (Old view I am using)
Please click on write new mail. then below code tries to attch the file for attchment but it falis.

!!!!!! Please please please help me.!!!!!!!!!!!

So following is the code that clicks on Attachment link.
Please note references added in below code are
Microsoft Internet Conrols
Micosoft HTML Object Library


Public objIE As InternetExplorer
Public objAIE As InternetExplorer
Public ElementCol As MSHTML.IHTMLElementCollection
Public btnInput As MSHTML.HTMLInputElement
Public link As MSHTML.HTMLAnchorElement

sub AutoRediff()

Set objShell = CreateObject("Shell.Application")
Set objShellWindows = objShell.Windows

Set ElementCol = objIE.document.getElementsByTagName("a")
For Each link In ElementCol
If InStr(link.href, "javascript:attachment") Then
MsgBox link.href
link.Click
Exit For
End If
Next

' ********This code sets objAIE to the attchmemnt window.... So each 'control of attchment window I can access using objAIE *************

Set objShellWindows = objShell.Windows
For j = 0 To objShellWindows.Count - 1
Set objaie = objShellWindows.Item(j)
If InStr(objaie.LocationURL, "http://f5mail.rediff.com/bn/wupload.cgi") Then


'********** This code I am using to set the file selector value. That is 'attchment. But it is not working. *****************************

Set ElementCol = objAIE.document.getElementsByTagName("INPUT")
For Each btnInput In ElementCol
Debug.Print btnInput.Name
If btnInput.Name = "upfile1" Then
btnInput.Value = "C:\New Folder\B.xls"
' objaie.document.form(0).Filename.Value = "C:\New Folder\B.xls"
End If
Next
End if


'******** This code clicks on attch button.**************
Set ElementCol = objAIE.Document.getElementsByTagName("input")
For Each link1 In ElementCol
If link1.Name = "attach" Then
link1.Click
End If
Next
'**************************************************

End Sub

Here I am not able to input the value please can anyone help me with this. It will really appreciable as i am tring to do this since last 2 days.

Please help me.

Thanks in advance.

Thanks,
Ganesh.
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

Forum statistics

Threads
1,224,609
Messages
6,179,879
Members
452,948
Latest member
Dupuhini

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top