vba script to log into website help

mrustemo

New Member
Joined
Sep 30, 2014
Messages
4
i found vba code that automatically opens a new session of IE explorer, navigates to a specific website and then logs in. it only seems to work when i test it in the vba editor.

it is currently assigend to a shape however it doesnt keep the IE session active and ends up pasting the login information to the spreadsheet. any help to fix is appreciated.

Code:
Sub internetlogon()
Dim IE As Object
Set IE = CreateObject("InternetExplorer.Application")
IeHandle = IE.Hwnd
'Go to this Web Page!
IE.Navigate "connectmeeting.att.com"
'Check for good connection to web page loop!
Do
If IE.ReadyState = 4 Then
IE.Visible = False
Exit Do
Else
DoEvents
End If
Loop
'Wait for window to open!
Application.Wait (Now + TimeValue("0:00:01"))
IE.Visible = True
'Send logon information
SendKeys "8665282256", True
SendKeys "{TAB}", True
Application.Wait (Now + TimeValue("0:00:01"))
SendKeys "5972046", True
SendKeys "{TAB}", True
SendKeys "mrustemov@cltairport.com", True
SendKeys "{TAB}", True
SendKeys "Mirza", True
SendKeys "{TAB}", True
SendKeys "Rustemov", True
Application.Wait (Now + TimeValue("0:00:01"))
SendKeys "{TAB}", True
SendKeys "{ENTER}", True
Application.Wait (Now + TimeValue("0:00:01"))
SendKeys "{TAB}", True
SendKeys "{TAB}", True
SendKeys "{TAB}", True
SendKeys "{TAB}", True
SendKeys "{TAB}", True
SendKeys "{TAB}", True
SendKeys "{TAB}", True
SendKeys "{TAB}", True
SendKeys "{TAB}", True
SendKeys "{TAB}", True
SendKeys "{TAB}", True
SendKeys "{TAB}", True
SendKeys "{TAB}", True
SendKeys "{TAB}", True
SendKeys "{TAB}", True
SendKeys "{TAB}", True
SendKeys "{TAB}", True
SendKeys "{TAB}", True
SendKeys "{ENTER}", True
Application.Wait (Now + TimeValue("0:00:01"))
SendKeys "2079", True
SendKeys "{ENTER}", True

End Sub
[code]
 

Some videos you may like

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
75,831
Office Version
  1. 365
Platform
  1. Windows
Can you post the URL of the website you are interested in?
 

mrustemo

New Member
Joined
Sep 30, 2014
Messages
4
the macro works fine when i use it in the vba editor, but not when it is activated by the shape
 

Watch MrExcel Video

Forum statistics

Threads
1,109,201
Messages
5,527,383
Members
409,759
Latest member
KCH

This Week's Hot Topics

Top