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]
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Can you post the URL of the website you are interested in?
 
Upvote 0
the macro works fine when i use it in the vba editor, but not when it is activated by the shape
 
Upvote 0

Forum statistics

Threads
1,214,956
Messages
6,122,465
Members
449,085
Latest member
ExcelError

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