Help not getting value from cell E20

josros60

Well-known Member
Joined
Jun 27, 2010
Messages
780
Office Version
  1. 365
Hi,

I have the code below to log in to website automatically by getting username, password from cells in a spreadsheet, problem having is that when click and goes to website
filled in the password in the box from cell F20 but not in the Login box that should get it from cell E20 (The line in red is not working ), please help what I am doing wrong.

here is the code:

Code:
Sub mt()Dim HTMLDoc As HTMLDocument
Dim MyBrowser As InternetExplorer
Dim WS As Worksheet


Dim MyHTML_Element As IHTMLElement
Dim MyURL As String
On Error GoTo Err_Clear
MyURL = "https://onlinebillmanager.globysonline.com/cv/scripts/B3B0/eng/log.asp?gru=204948601"
Set MyBrowser = New InternetExplorer
MyBrowser.Silent = True
MyBrowser.navigate MyURL
MyBrowser.Visible = True
Do
Loop Until MyBrowser.readyState = READYSTATE_COMPLETE
Set HTMLDoc = MyBrowser.document
[COLOR=#ff0000]HTMLDoc.all.login.Value = Worksheets("Sheet1").Range("E20")[/COLOR] 'Enter your email id here
HTMLDoc.all.Password1.Value = Worksheets("Sheet1").Range("F20") 'Enter your password here
For Each MyHTML_Element In HTMLDoc.getElementsByTagName(“input”)
If MyHTML_Element.Type = “loging” Then MyHTML_Element.Click: Exit For
Next
Err_Clear:
If Err <> 0 Then
Err.Clear
Resume Next
End If
End Sub
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
maybe add these bits

Dim EmailID as string
EmailId = Worksheets("Sheet1").Range("E20")
HTMLDoc.all.login = EmailId
 
Last edited:
Upvote 0
thank you so much, it worked.

question after log in I have to click view current invoice to see the invoice listing, how can add a line in same code so when log in also go to current invoice, the source in the current invoice button is:

<a id="btnViewCurrentBill" href="javascript:__doPostBack('btnViewCurrentBill','')">View Current Bill</a>
 
Upvote 0
sorry have to post it again.

thank you so much, it worked.

question after log in I have to click view current invoice to see the invoice listing, how can add a line in same code so when log in also go to current invoice, the source in the current invoice button is:

<a id="btnViewCurrentBill" href="javascript:__doPostBack('btnViewCurrentBill','')">View Current Bill</a>

 
Upvote 0

Forum statistics

Threads
1,215,059
Messages
6,122,918
Members
449,093
Latest member
dbomb1414

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