I have a list of accnts and need to automate ie, access my program with username, pw, etc. navigate links in the page (href) copy the account notes into excel and search the notes for whatever I input as a search term. I have been playing around with the VBA code and can get logged into the website but am having problems accessing the href links. They will need to open in same window. I have the following code so far and it tries to open the HREF link in seperate window and it does not work.
The following info is the HTML from my webpage
Any help with a portion or all of my needs would be greatly appreciated. NB
Code:
Sub GoToWebSiteAndEnterPWUN()
Dim appIE As Object ' InternetExplorer.Application
Dim sURL As String
Dim UserN As Variant, PW As Variant, PW2 As Variant
Dim ElementCol As Object
Dim AccntNmbr As Variant
Dim btnInput As Object
Dim BttnID As Object
Dim Subframe As Object
Set appIE = CreateObject("InternetExplorer.Application")
sURL = "http://myurl"
With appIE
.Navigate sURL
.Visible = True
While appIE.busy
DoEvents:
Wend
End With
Set BttnID = appIE.document.getElementbyID("rdoTC")
If BttnID.Value = "Y" Then BttnID.Checked = True
appIE.document.all("btnTC").Click
Do While appIE.busy
Loop
Set UserN = appIE.document.getElementsByName("txtTheAgent")
If Not UserN Is Nothing Then
UserN(0).Value = "MYID"
End If
Set PW = appIE.document.getElementsByName("txtTheInitials") ' password
If Not PW Is Nothing Then
PW(0).Value = "MYIN"
End If
Set PW2 = appIE.document.getElementsByName("txtThePassword") ' password
If Not PW2 Is Nothing Then
PW2(0).Value = "MyPW"
End If
' click 'Submit' button
appIE.document.all("btnSubmit").Click
Do While appIE.busy
Loop
Set AccntNmbr = appIE.document.getElementsByName("txtInquire")
If Not AccntNmbr Is Nothing Then
AccntNmbr(0).Value = "5037432967" 'this is where I could link to excel range for accnt nmbrs
End If
appIE.document.Links(0).target = "ACCT"
appIE.document.Links(0).Click
HTML:
id=txtInquire name=txtInquire tabindex=201 onkeyup=return rdoInqType *******() accesskey=Q class=shrink title=Enter criteria and select a search type below 'this part i can get to its the following that has me stumped...
href= javascript:rdoInqType *******('ACCT') title= Enter account id above, then click 'Acct' to search by account id.