Results 1 to 7 of 7

Automatically click on link in Internet Explorer using VBA

Threaded View

  1. #1
    Registered User
    Join Date
    09-26-2012
    Location
    Virginia Beach
    MS-Off Ver
    Excel 2010
    Posts
    5

    Automatically click on link in Internet Explorer using VBA

    Hi Everyone,

    My question is really simple. I want to use VBA to open explorer, navigate to google.com and click on the "Gmail" link in the upper right corner.

    I can open explorer and navigate to google, however when I inspect the element for the Gmail link, it does not have an ID. I tried to work into it to no avail using parent IDs and class names. I honestly didn't know what I was doing, but I'll pose the code below anyway. THANKS FOR THE HELP!

    Sub OpenExplorer()
    
    Dim IE As Object
    Set IE = CreateObject("InternetExplorer.Application")
    Dim link As Object
    
    IE.navigate "http://www.google.com"
    IE.Visible = True
    
    While IE.BusyDoEvents
    Wend
    
    'This is where I attempted to find the link:
    IE.document.getElementById("gb").getElementsByClassName("gb_Ub gb_Rc").getElementsByClassName("gb_7 gb_Rc gb_h gb_Qc gb_Uc").getElementsByClassName("gb_Cc gb_h gb_Rc gb_Kc").getElementsByClassName("gb_g gb_h").getElementsByClassName("gb_f").Click
    
    End Sub
    Last edited by mistermetaj; 12-13-2014 at 03:01 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Macro to download a file by click a button on internet link
    By NoreenDeasy in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-09-2014, 12:19 PM
  2. internet explorer control click
    By tomro1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-14-2014, 12:11 PM
  3. loop through a range and open internet explorer where link is valid
    By papasmurfuo9 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-30-2014, 05:58 AM
  4. Replies: 4
    Last Post: 04-05-2014, 08:53 AM
  5. Internet Explorer Extraction on Click
    By lundawg in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-09-2011, 06:08 PM

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