I am trying to automate a code that we log me in and out at work.
I have this code that logs me into an account:
After I get the browser to open the page I would like to click on a link.Code:Option Explicit Public Sub Press_Button() 'make sure you add references to Microsoft Internet Controls (shdocvw.dll) and 'Microsoft HTML object Library. 'Code will NOT run otherwise. Dim objIE As SHDocVw.InternetExplorer 'microsoft internet controls (shdocvw.dll) Dim htmlDoc As MSHTML.HTMLDocument 'Microsoft HTML Object Library Dim htmlInput As MSHTML.HTMLInputElement Dim htmlColl As MSHTML.IHTMLElementCollection Set objIE = New SHDocVw.InternetExplorer With objIE .Navigate "https://www.paycomonline.net/v4/ee/ee-login.php" ' Main page .Visible = 1 Do While .READYSTATE <> 4: DoEvents: Loop Application.Wait (Now + TimeValue("0:00:02")) 'set user name and password Set htmlDoc = .Document Set htmlColl = htmlDoc.getElementsByTagName("INPUT") Do While htmlDoc.READYSTATE <> "complete": DoEvents: Loop For Each htmlInput In htmlColl If htmlInput.Name = "username" Then htmlInput.Value = "User ID Here" Else If htmlInput.Name = "userpass" Then htmlInput.Value = "Password Here" Else If htmlInput.Name = "userpin" Then htmlInput.Value = "PIN Here" End If End If End If Next htmlInput 'click login Set htmlDoc = .Document Set htmlColl = htmlDoc.getElementsByTagName("input") Do While htmlDoc.READYSTATE <> "complete": DoEvents: Loop For Each htmlInput In htmlColl If Trim(htmlInput.Type) = "submit" Then htmlInput.Click Exit For End If Next htmlInput End With End Sub
On the webpage the link appears as Web Timeclock
Here is the source code for the webpage:
Is there anyway to add this into the existing code? I am unfamiliar with HTML and using VBA to automate browser functions. I have lucked up so far being able to modify some existing code I found on a thread....Code:<A href="ee-tawebclock.php?clockid=WEB00">Web TimeClock</A><A href="ee-tawebsheet.php?clockid=WEB02&cmdperiodinit=1">Web TimeSheet Read-Only</A><A href="ee-




Reply With Quote
Bookmarks