Accessing Accounts and Searching

nbob

Board Regular
Joined
Nov 9, 2011
Messages
52
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.

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
The following info is the HTML from my webpage

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.
Any help with a portion or all of my needs would be greatly appreciated. NB
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

Forum statistics

Threads
1,223,246
Messages
6,170,996
Members
452,373
Latest member
TimReeks

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top