Navigating webpage pulldown menu with vba

jjones32

New Member
Joined
Aug 25, 2011
Messages
5
I'm having trouble navigating a website using vba macro. Once logged in to the website, I need to be able to do the following:

1) Select SEARCH ----> CUSTOM SEARCH/REPORT
2) Wait until new page loads then, Select "DaysOnMarket" from "Saved Searches" list.
3) Wait until new page loads then, select just "All" for the Status, place a 1 in the "Min" and "Max" txt fields, and click on "Search"

I've spent hours trying to figure this out already (specifically on how to select the pull down menu choice). Any help in pointing me in the right direction will be greatly appreciated. Thanks in advance.

Code:
Sub MLSData()
 
    Dim IEApp As Object                     'Variable for Internet Explorer Object
    Dim IEhandle As Long                    'Internet Explorer handle
    Dim XLhandle As Long                    'Excel handle
    Dim UserN As Variant
    Dim PassW As Variant
        
    Dim btnInput As Object                  'MSHTML.HTMLInputElement
    Dim ElementCol As Object                'MSHTML.IHTMLElementCollection
 
    'Identify HANDLE for current Excel
    XLhandle = Application.hwnd
    
    'Open up Internet Explorer session
    Set IEApp = CreateObject("InternetExplorer.Application")
    IEApp.Navigate ("[URL]http://ntreis.marketlinx.com/TempoCommon/Authentication/Login.aspx?ReturnUrl=%2f[/URL]")
    IEApp.StatusBar = True
    IEApp.Toolbar = True
    IEApp.Visible = True
    IEApp.Resizable = True
    IEApp.AddressBar = True
    
    'Wait until IE has finished loading itself.
    Do While IEApp.busy: DoEvents: Loop
    Do Until IEApp.ReadyState = 4: DoEvents: Loop
    Application.Wait Now + TimeValue("00:00:01")
   
    'Identify HANDLE for current Internet Explorer Window#1
    IEhandle = IEApp.hwnd
    
    
    'Enter username and password in textboxes
    Set UserN = IEApp.Document.getElementsByName("LoginCtrl$txtLoginUsername")
    If Not UserN Is Nothing Then
        UserN(0).Value = "0537404"
    End If
    
    Set PassW = IEApp.Document.getElementsByName("LoginCtrl$txtPassword")
    If Not PassW Is Nothing Then
        PassW(0).Value = "will provide privately"
    End If
    ' click 'Submit' button
    Set ElementCol = IEApp.Document.getElementsByTagName("INPUT")
    For Each btnInput In ElementCol
        If btnInput.Value = "Login" Then
            btnInput.Click
            Exit For
        End If
    Next btnInput
    'Wait for webpage to load
    Do While IEApp.busy: DoEvents: Loop
    Do Until IEApp.ReadyState = 4: DoEvents: Loop
    Application.Wait Now + TimeValue("00:00:01")
        
End Sub
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Can someone please take at this problem. I've researched everything I know to look at. I need some external expertise :-).
 
Upvote 0

Forum statistics

Threads
1,224,602
Messages
6,179,844
Members
452,948
Latest member
UsmanAli786

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