Question : Sendkeys to Webpage in IE  by VBA

Dear Experts,

When I navigate the bank login website page  by VBA with .navigate, and I found there is
no any element ID or type for username and password in the source code of html. It is
javascript function to let user to access the login page. So I need to use sendkey("myloginname")
instead of .document.all("username")="myloginname" to enter my login name in the webpage  . The problem is when I run the sendkey("myloginname") in VBA, the "myloginname" is pasted on my VBA code not the location of the login box of  the login page I navigate. How Can I control my cursor and move it to the bank page and exact login box?
I tried the sendkey() before, sometimes, it works but sometime it doesn't work as I said above.
it seems it is related to cursor position issue ?

Please veiw the following code espeically with Bold type for the sendkey which will send the
myloginname inside of my banklogin() code.

Please advise
Thanks

My code is here :
-------------------
Sub Banklogin()
Dim myIE As SHDocVw.InternetExplorer
Set myIE = Nothing
Set myIE = CreateObject("InternetExplorer.Application")
.navigate "www.mybank.com"
call waiting
sendkey ("myloginname")
myloginname.document.links(6).click           'enter the next page of login
End Sub
Function WAITING(ByRef myIE As SHDocVw.InternetExplorer)
With myIE
    Do Until Not .Busy And .readyState = READYSTATE_COMPLETE
         Loop
       
 End With
End Function


 

Answer : Sendkeys to Webpage in IE  by VBA

When you make a request for a file (or folder) from an IIS server, IIS first checks if the file exists - if not you get the 404 errors - if it does exist it checks the extension of the file requested, and if it's .aspx IIS hands the request off to the .Net engine.

So, in your case, since the file doesn't exist, the request is never given to the .Net processing engine - thus your code will never run.  The way to get around this is to either 1) make sure the file/folder exists (even if it's basically empty) or 2) Have IIS not do any checking and just automatically give every request to .Net.

Are you on IIS 7 or 6?

Random Solutions  
 
programming4us programming4us