Hello VBA and HTML Object Library coders,
I have a cool personal project (at least I think it's cool). I am really into tracking my personal finances and I am using GnuCash to manage all my money and bank accounts as if it were a real business. If interested, GnuCash is free and available at Free Accounting Software | GnuCash ... there is a ton of support behind this gnu project and I've learned more from reading their accounting manuals than I did in my college courses!
Anyways, back to the project. I'm essentially trying to create a script via VBA (don't know any scripting languages) to pull my .QIF banking transaction history every week and I'll manually assign it to the general ledger. With the code that I currently wrote, I'm able to login to my 5/3 account, navigate to the export history window, but I get stuck at trying to choose the right account and enter the dates.
Here are three sites I'm using as references for my code:
VBA Express : Excel - Log In to an Internet Site
Reading web data with VBA from excel using Microsoft HTML Object Library and Microsoft Internet Controls | Menelaos Bakopoulos
InternetExplorer Object
Here's the code I have so far:
To see what the export history online account interface looks like, go to a google image search and search for "ib‑sc‑internet‑banking‑1.jpg" ... I'll try to insert the picture here:
I was having issues pasting the source code from the website. I can post this later if that would be helpful to figuring out this project (which it seems like it would be). Thanks for your consideration to help!
I have a cool personal project (at least I think it's cool). I am really into tracking my personal finances and I am using GnuCash to manage all my money and bank accounts as if it were a real business. If interested, GnuCash is free and available at Free Accounting Software | GnuCash ... there is a ton of support behind this gnu project and I've learned more from reading their accounting manuals than I did in my college courses!
Anyways, back to the project. I'm essentially trying to create a script via VBA (don't know any scripting languages) to pull my .QIF banking transaction history every week and I'll manually assign it to the general ledger. With the code that I currently wrote, I'm able to login to my 5/3 account, navigate to the export history window, but I get stuck at trying to choose the right account and enter the dates.
Here are three sites I'm using as references for my code:
VBA Express : Excel - Log In to an Internet Site
Reading web data with VBA from excel using Microsoft HTML Object Library and Microsoft Internet Controls | Menelaos Bakopoulos
InternetExplorer Object
Here's the code I have so far:
Code:
'Make sure Microsoft HTML Object Library and Internet Controls are selected from references
Sub IE_login()
Dim ie As InternetExplorer
Dim C
Dim ULogin As Boolean, ieForm
Dim myPass As String, myUser As String
Dim historyDate As Date
myUser = "XX loginusername XX"
myPass = "XX mypassword XX"
historyDate = Now
historyDate = Format(historyDate, "mm/dd/yyyy")
'Attempting to open IE and login
Set ie = New InternetExplorer
ie.Visible = True
ie.navigate "https://www.53.com/site"
'Loop until ie page is fully loaded
Do Until ie.ReadyState = READYSTATE_COMPLETE
Loop
'Look for password Form by finding test "Password"
For Each ieForm In ie.Document.Forms
If InStr(ieForm.innerText, "Password") <> 0 Then
ULogin = True
'enter details
ieForm(0).Value = myUser
ieForm(1).Value = myPass
'login
ieForm.submit
Exit For
Else
End If
Next
'Wait 7 seconds for good pracitce
Application.Wait DateAdd("s", 7, Now)
'Loop until online banking page is fully loaded
Do Until ie.ReadyState = READYSTATE_COMPLETE
Loop
'Attempt to navigate to Export files site
ie.navigate "https://www.53.com/servlet/efsonline/accounts-export.html"
'Wait 7 seconds for good pracitce
Application.Wait DateAdd("s", 7, Now)
'Loop until online banking page is fully loaded
Do Until ie.ReadyState = READYSTATE_COMPLETE
Loop
' *************************************************
' *************************************************
' ***** The rest of the code is where ******
' ***** I beging to have issues ******
' ***** I don't know what to do with ******
' ***** the textfields and dates ******
' *************************************************
' *************************************************
'Look for history From by finding test "Account"
For Each ieForm In ie.Document.Forms
If InStr(ieForm.innerText, "Account") <> 0 Then
For Each ieForm.Selectedlist In ieForm
ULogin = True
If ieForm(0).Value = _
"XX checking account XX" Or _
"XX savings account XX" Then
ieForm(1).Value = historyDate - Day(7)
ieForm(2).Value = historyDate
ieForm.submit
' then I would have more code here to process a file download
End If
Next ieForm.Selectedlist
End If
Next
End Sub
To see what the export history online account interface looks like, go to a google image search and search for "ib‑sc‑internet‑banking‑1.jpg" ... I'll try to insert the picture here:
I was having issues pasting the source code from the website. I can post this later if that would be helpful to figuring out this project (which it seems like it would be). Thanks for your consideration to help!