Remove login window

needhelp2

Active Member
Joined
Apr 19, 2011
Messages
250
Hi,

I am trying to login in to Google from excel 2003,when ever i click on button it give me login forum and i have to submit it to login on web after filling required fields,On submit its take about 30sec to process after stuck.

Is there any way i fix my range,where from or where i place my login and password,
On pressing button it copy id and password and then login?

Kindly check attached file,Please give me a little assistance.

Code:
Option Explicit

Private Sub Cancel_Click()
    Unload Me
End Sub

Private Sub Submit_Click()
    Excel.Application.Cursor = xlWait
    LaunchGamil Me.TextBox1.Value, Me.TextBox2.Value
    Unload Me
    Excel.Application.Cursor = xlDefault
End Sub

Private Sub LaunchGamil(username As String, password As String)
    Const strURL_c As String = "http://mail.google.com"
    Dim objIE As SHDocVw.InternetExplorer
    Dim ieDoc As MSHTML.HTMLDocument
    Dim tbxPwdFld As MSHTML.HTMLInputElement
    Dim tbxUsrFld As MSHTML.HTMLInputElement
    Dim btnSubmit As MSHTML.HTMLInputElement
    On Error GoTo Err_Hnd
    'Create Internet Explorer Object
    Set objIE = New SHDocVw.InternetExplorer
    'Navigate the URL
    objIE.Navigate strURL_c
    'Wait for page to load
    Do Until objIE.ReadyState = READYSTATE_COMPLETE: Loop
    'Get document object
    Set ieDoc = objIE.Document
    'Get username/password fields and submit button.
    Set tbxPwdFld = ieDoc.all.Item("Passwd")
    Set tbxUsrFld = ieDoc.all.Item("Email")
    Set btnSubmit = ieDoc.all.Item("signIn")
    'Fill Fields
    tbxUsrFld.Value = username
    tbxPwdFld.Value = password
    'Click submit
    btnSubmit.Click
    'Wait for transistion page to load
    Do Until objIE.ReadyState = READYSTATE_COMPLETE: Loop
    'Wait for main page to load
    Do Until objIE.ReadyState = READYSTATE_COMPLETE: Loop
Err_Hnd: '(Fail gracefully)
    objIE.Visible = True
End Sub
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
nop its not related to it,infect i need to remove login window which apear and then i have to enter id and passwords.but i need that it has to be taken from any specific cell or range.
 
Upvote 0
Just set the values of password and username.

Code:
password = Range("A1")

username = Range("A2")
 
Upvote 0
No need to remove anything, just add that code in the LaunchGmail sub.

Change the ranges of course.
 
Upvote 0
Well I don't know what you mean exactly.

In the code you've got IE only becomes visible after the login has been completed.

I might be wrong about that though, the text is pretty small.:)

In fact I'm not sure what that code is doing.

The values for username and password are supposed to come from a userform apparently.
 
Upvote 0
see it complete code
then i click on button i appears a login and password form to enter manually
once i enter bit then i press submit button,and IE appears

Code:
Option Explicit

Private Sub Cancel_Click()
    Unload Me
End Sub

Private Sub Submit_Click()
    Excel.Application.Cursor = xlWait
    LaunchGamil Me.TextBox1.Value, Me.TextBox2.Value
    Unload Me
    Excel.Application.Cursor = xlDefault
End Sub

Private Sub LaunchGamil(username As String, password As String)
    Const strURL_c As String = "http://mail.google.com"
    Dim objIE As SHDocVw.InternetExplorer
    Dim ieDoc As MSHTML.HTMLDocument
    Dim tbxPwdFld As MSHTML.HTMLInputElement
    Dim tbxUsrFld As MSHTML.HTMLInputElement
    Dim btnSubmit As MSHTML.HTMLInputElement
    On Error GoTo Err_Hnd
    'Create Internet Explorer Object
    Set objIE = New SHDocVw.InternetExplorer
    'Navigate the URL
    objIE.Navigate strURL_c
    'Wait for page to load
    Do Until objIE.ReadyState = READYSTATE_COMPLETE: Loop
    'Get document object
    Set ieDoc = objIE.Document
    'Get username/password fields and submit button.
    Set tbxPwdFld = ieDoc.all.Item("Passwd")
    Set tbxUsrFld = ieDoc.all.Item("Email")
    Set btnSubmit = ieDoc.all.Item("signIn")
    'Fill Fields
    tbxUsrFld.Value = username
    tbxPwdFld.Value = password
    password = Range("A1")
    username = Range("A2")
    'Click submit
    btnSubmit.Click
    'Wait for transistion page to load
    Do Until objIE.ReadyState = READYSTATE_COMPLETE: Loop
    'Wait for main page to load
    Do Until objIE.ReadyState = READYSTATE_COMPLETE: Loop
Err_Hnd: '(Fail gracefully)
    objIE.Visible = True
End Sub
 
Upvote 0
infect i dont want to appear form i want when i click on button it automatically copy id and password from range and then open IE and further process
 
Upvote 0

Forum statistics

Threads
1,224,602
Messages
6,179,844
Members
452,948
Latest member
UsmanAli786

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