+ Reply to Thread
Results 1 to 7 of 7

Automatically click on link in Internet Explorer using VBA

  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!

    Please Login or Register  to view this content.
    Last edited by mistermetaj; 12-13-2014 at 03:01 PM.

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Automatically click on link in Internet Explorer using VBA

    WHY NOT NAVIGATE TO
    "https://accounts.google.com/ServiceLogin?continue=http%3A%2F%2Fmail.google.com%2Fmail%2F%3Fpc%3Dtopnav-about-en&service=mail&dsh=8065733805618555414"
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

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

    Re: Automatically click on link in Internet Explorer using VBA

    Quote Originally Posted by martindwilson View Post
    WHY NOT NAVIGATE TO
    "https://accounts.google.com/ServiceLogin?continue=http%3A%2F%2Fmail.google.com%2Fmail%2F%3Fpc%3Dtopnav-about-en&service=mail&dsh=8065733805618555414"
    I know I can navigate directly to the link. However, I am just using this Gmail question as a simple example since I know everyone has access to do it. My actual project is based on a different webpage where the navigable link changes.

  4. #4
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Automatically click on link in Internet Explorer using VBA

    Hello mistermetaj,

    Post deleted.
    Last edited by Winon; 12-14-2014 at 05:18 AM. Reason: Code Tags were added.
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

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

    Re: Automatically click on link in Internet Explorer using VBA

    Quote Originally Posted by Winon View Post
    Hello mistermetaj,

    Congratulations on your first post, and a hearty welcome to now officially be considered as a "family member".

    However, your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)

    No hard feelings, o.k.

    We all have to abide to the rules.

    Regards.
    Thanks. Fixed it.

  6. #6
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Automatically click on link in Internet Explorer using VBA

    asking the correct question would help! how are we supposed to guess that from the info provided?
    to link to images you'd use
    "https://www.google.co.uk/imghp?hl=en&tab=wi&ei=OpGMVK2pNezB7Aa1cQ&ved=0CAQQqi4oAg"
    to link to mail
    "https://mail.google.com/mail/?tab=wm"
    well thats what i see when i inspect the elements
    Attached Images Attached Images
    Last edited by martindwilson; 12-13-2014 at 03:20 PM.

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

    Re: Automatically click on link in Internet Explorer using VBA

    Quote Originally Posted by martindwilson View Post
    asking the correct question would help! how are we supposed to guess that from the info provided?
    to link to images you'd use
    "https://mail.google.com/mail/?tab=wm"
    to link to mail
    "https://mail.google.com/mail/?tab=wm"
    well thats what i see when i inspect the elements
    I think I need to be more clear with my question. I understand that I could put the links you are showing me in the part of my code that is

    Please Login or Register  to view this content.

    But that isn't my question. I need to program VBA such that it clicks on the 'Gmail' element through some form of code such as:

    Please Login or Register  to view this content.
    where the ID of the Element is unique and is automatically clicked on. My problem is, and your post shows the HTML, there is no unique ID for the link, so I need to know if there is an alternative in VBA to identify the Element and click on it.

    I appreciate the help, and hopefully I am making my question more clear.

+ 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. 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