View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
AB[_2_] AB[_2_] is offline
external usenet poster
 
Posts: 236
Default How to access certain website log in with user name and passwordand click certain button?

Check this link out:
http://www.mrexcel.com/forum/showthread.php?t=302438

Something to get you started:

In your VBA set refference to:
Microsoft Internet controls

Then use some code along these lines - it's not complete for you -
you'll need to finish it up yourself but it can get you started.

Option Explicit

Sub ClcikMyButton()
Dim ie As SHDocVw.InternetExplorer
Dim hDoc As MSHTML.HTMLDocument

Set ie = New SHDocVw.InternetExplorer

With ie
.Visible = True

Do Until Not ie.Busy And ie.ReadyState = 4
DoEvents
Loop

.Navigate "http://www.google.com"'<--put your url here

'wait until IE finished loading the page
Do Until Not ie.Busy And ie.ReadyState = 4
DoEvents
Loop

End With

Set hDoc = ie.Document


'In some web browser find the ELEMENT_IDs of the textboxes, buttons
of the URL of your interest.
'If they don't have IDs - you'll need to figure out a different way
of accessing those html elements.
With hDoc
.getElementById("PutYourUserNameELEMENT_ID_here"). Value =
"YourUserName"
.getElementById("PutYourPWDELEMENT_ID_here").Value = "YourPWD"
.getElementById("PutYourLogonButtonELEMENT_ID_here ").Click'This
can be done alsy with form.subbmit - depending on the website.
End With


'put here some code to navigate to your url where the button to click
is
'put here some code to click on the button

End Sub

On Jan 4, 2:00*pm, geniusideas wrote:
Hi,
I have new project related to VBA. I search google and found many
solution but doesn't work. The project is to access specific website
log in with user name and password and later click specific button to
get some info.
Please help if you the coding in vba. Thanks