nhiribarne
04-23-2015, 08:55 AM
Hello everybody,
My goal is to be able to, thanks to VBA:
-Open an internet website
-Log in on the website that I just opened
I could have find this code which permit me perfectly to open an Internet page without any problem:
Option Explicit
Sub WebPage()
Dim IEapp As Object
Dim WebUrl As String
Set IEapp = CreateObject("InternetExplorer.Application") 'Set IEapp = InternetExplorer
WebUrl = "http://www.vbaexpress.com/forum/login.php?do=logout&logouthash=1429803449-4a409588dabd5e7668fee57407c8fffb0807ed34"
'You can't really automate the passing of variables (ie. Login Name and Passwords) using Chrome or FireFox, but the below code will open the desired page
'Shell ("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe -url " & WebUrl) 'Opens URL in Chrome if installed, replace chrome.exe with FireFox
With IEapp
.Silent = True 'No Pop-ups
.Visible = True 'Set InternetExplorer to Visible
.Navigate WebUrl 'Load web page
'Run and Wait, if you intend on passing variables at a later stage
Do While .Busy
DoEvents
Loop
Do While .ReadyState <> 4
DoEvents
Loop
End With
End Sub
I try to find out how to log in but I could't sort it out.
I went through the HTML code to find out the id of the "log in" and the "password" button which are respectively "navbar_username" and "navbar_password".
I tried to use some
IEapp.document.forms(0).all("navbar_username").value="nhiribarne"
IEapp.document.forms(0).submit
but unfortunately, I couln't get it work.
If anybody is able to help me, I woule really appreciate it. If I'm not clear enough in my explanation, please, let me know :-)
Have a good day from Portugal.
My goal is to be able to, thanks to VBA:
-Open an internet website
-Log in on the website that I just opened
I could have find this code which permit me perfectly to open an Internet page without any problem:
Option Explicit
Sub WebPage()
Dim IEapp As Object
Dim WebUrl As String
Set IEapp = CreateObject("InternetExplorer.Application") 'Set IEapp = InternetExplorer
WebUrl = "http://www.vbaexpress.com/forum/login.php?do=logout&logouthash=1429803449-4a409588dabd5e7668fee57407c8fffb0807ed34"
'You can't really automate the passing of variables (ie. Login Name and Passwords) using Chrome or FireFox, but the below code will open the desired page
'Shell ("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe -url " & WebUrl) 'Opens URL in Chrome if installed, replace chrome.exe with FireFox
With IEapp
.Silent = True 'No Pop-ups
.Visible = True 'Set InternetExplorer to Visible
.Navigate WebUrl 'Load web page
'Run and Wait, if you intend on passing variables at a later stage
Do While .Busy
DoEvents
Loop
Do While .ReadyState <> 4
DoEvents
Loop
End With
End Sub
I try to find out how to log in but I could't sort it out.
I went through the HTML code to find out the id of the "log in" and the "password" button which are respectively "navbar_username" and "navbar_password".
I tried to use some
IEapp.document.forms(0).all("navbar_username").value="nhiribarne"
IEapp.document.forms(0).submit
but unfortunately, I couln't get it work.
If anybody is able to help me, I woule really appreciate it. If I'm not clear enough in my explanation, please, let me know :-)
Have a good day from Portugal.