+ Reply to Thread
Results 1 to 3 of 3

Query from a website that requires selecting from a dropdown box.

Hybrid View

  1. #1
    Registered User
    Join Date
    05-20-2016
    Location
    USA
    MS-Off Ver
    2016
    Posts
    1

    Query from a website that requires selecting from a dropdown box.

    I am attempting to make an excel sheet for calculating my grades, along with GPA, class rank, etc. To do this automatically, i need to pull information from my school's grade database, but in order to log onto the website, you must select your school district from a drop-down menu, as well as entering your credentials. Any idea how this can be accomplished automatically?

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,957

    Re: Query from a website that requires selecting from a dropdown box.

    Here is a code fragment that should get you started
    Public Sub LoginDashboard()
    Dim iDD As Long ' Loop variable for items in a dropdown box
    Dim MyTime As Long
    MyTime = Range("MyTime")
    Range("C5") = Now()
    Range("A14:D100").ClearContents
    ' Open the browser
    Set ie = CreateObject("InternetExplorer.Application")
    
    ie.Visible = True
            
    'Navigate to the URL
    
    ie.Navigate Range("DashboardURL")
        
    Do Until ie.readystate = 4: DoEvents: Loop
    
    ' create reference to document
    Set doc = ie.document
    
    ' create references to the form, inputs and button
    Set ieFrm = doc.forms("login")
    Set ieUser = doc.getelementbyID("USER")
    Set iePwd = doc.getelementbyID("PASSWORD")
    Set ieButton = doc.getelementbyID("idlogon")
        
    ' Enter the login credentials
     ieUser.Value = Range("MyLogin")
     iePwd.Value = Range("MyPassword")
    
    ' Log in
    ieButton.Click
    WaitForIEReady
    
    ' Navigate to the page.
    ...
    Here is the WaitForIEReady
    Public Sub WaitForIEReady()
    Do While doc.readystate <> "complete"
        DoEvents
    Loop
    End Sub
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,957

    Re: Query from a website that requires selecting from a dropdown box.

    Sorry, I misread the requirement. Here is the section of code you probably need.
    ' Set the Core indicator
    Set objDDOEM = doc.getelementbyID(DDBoxID(0)) ' select the first box (Core Indicator)
    objDDOEM.Value = Range("IsCore").Value

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Selecting the first object in a website table
    By Megatronixs in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-17-2014, 04:35 AM
  2. [SOLVED] Web Query - Website requires data input before it shows desired data
    By Anon2266 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 07-31-2014, 12:48 PM
  3. Submit options from dropdown menu and get data from website
    By zahoor1 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-27-2014, 06:31 AM
  4. VBA code to select dropdown value from a website form and submit
    By prabs_message in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-04-2014, 09:34 AM
  5. Select dropdown menu on website via vba
    By apatel100 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-05-2013, 12:30 PM
  6. Problem with selecting range with in query table after query refresh
    By shooter in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-31-2012, 11:55 AM
  7. Web Query Requires Form Fill In
    By bwebster in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-07-2010, 02:02 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1