ToastyStoemp
New Member
- Joined
- Aug 19, 2013
- Messages
- 3
Hello fellow humans, and not humans
So I have been struggeling with this code for the last few days now, after reading all sort of possible sollutions, none seem to work.
And hereby I reachout for you people.
Here at work we register our hours on the website Myhours.com, However to make graphs and such about the productivity of each employee, we need to download the information of the site, till now we have been doing this manually, till I joined the club and have been working on automating the process.
The file on the sebserver can only be obtained after logging in to your myhours account. So far I've set up an IHTMLElement with an InternetExplorer running in the background loggin in the website and browsing to the desired place. So it opens the CSV file in the browser window, and thats where I'm stuck, I cannot figure out how to either rip it from the browser view, or download it and import it. Help would be much apreciated.
May I excuse myself for my bad English, its not my first nor second tongue
ToastyStoemp
So I have been struggeling with this code for the last few days now, after reading all sort of possible sollutions, none seem to work.
And hereby I reachout for you people.
Here at work we register our hours on the website Myhours.com, However to make graphs and such about the productivity of each employee, we need to download the information of the site, till now we have been doing this manually, till I joined the club and have been working on automating the process.
The file on the sebserver can only be obtained after logging in to your myhours account. So far I've set up an IHTMLElement with an InternetExplorer running in the background loggin in the website and browsing to the desired place. So it opens the CSV file in the browser window, and thats where I'm stuck, I cannot figure out how to either rip it from the browser view, or download it and import it. Help would be much apreciated.
May I excuse myself for my bad English, its not my first nor second tongue
Code:
Dim HTMLDoc As HTMLDocument Dim oBrowser As InternetExplorer
Dim oHTML_Element As IHTMLElement
Dim sURL As String
On Error GoTo Err_Clear 'als er een error gebeurt ga naar de error behandeling
sURL = "http://www.myhours.com/default.asp" 'instellen van de URL
Set oBrowser = New InternetExplorer 'Opstellen van de browser
oBrowser.Silent = True
oBrowser.timeout = 60 'stel timeout in
oBrowser.navigate sURL 'ga naar de url
oBrowser.Visible = True 'Browser in de achtergrond (onzichtbaar) laten lopen
Do
Loop Until oBrowser.readyState = READYSTATE_COMPLETE 'Wachten tot de browser geladen is
Set HTMLDoc = oBrowser.document 'De webpagina tijdelijk opslaan, zodat kan worden gekeken waar de login en wachtwoord box staan
HTMLDoc.all.Email.Value = mail 'invullen van het e-mail adress op de myHours website
HTMLDoc.all.Password.Value = wachtwoord 'invullen van het wachtwoord op de myHours website
For Each oHTML_Element In HTMLDoc.getElementsByTagName("input") 'zoeken naar de "submit" knop
If oHTML_Element.Type = "submit" Then oHTML_Element.Click: Exit For 'het activeren van de "submit" knop
Next
Application.StatusBar = "De myHours gegevens opvragen, kan even duren..." 'De status baar message updaten
sURL = "http://www.myhours.com/myAccount/reports_timesheet1_csv.asp?period=&dateL=1%2F01%2F" & Me.listJaar.Value & "&dateH=31%2F12%2F" & Me.listJaar.Value & "&fieldsClient=True&fieldsDuration=True&fieldsTask=True&fieldsIn=True&fieldsOut=True&fieldsNote=True&alerts_color=True"
oBrowser.navigate sURL 'Browsen naar de pagina waar de uren worden weer gegeven
Do
Loop Until oBrowser.readyState = READYSTATE_COMPLETE 'Wachten tot de browser geladen is
ToastyStoemp