Get URL from intranet link name

  • 3 days ago from now i has been searching answers but still cant find it. Looking forwards this forum can help me...every month we downloaded over-time form from intranet by clicking a link...So i want to make a vba to get the URL from one of the link name in site. The attach image is the example...i want to get the URL encirled in red and paste into excel (filename otform.xlsm cell A1)..really need help...thanks
    [ATTACH=CONFIG]69100[/ATTACH]

  • Re: Get URL from intranet link name...need help.


    There are several ways to accomplish your task. Past this code in a regular code module.


    Here is one way:



    Please refer to this thread I answered a while back for another method using IE: CLICK HERE FOR SECOND OPTION

    Matt Mickle
    Using Excel 2010,2013 & 2016

  • Re: Get URL from intranet link name...need help.


    Hello it is not the one i want actually...maybe I want to simplify my question....please help me fix my VBA code to look for "MyLink" link name from the site (intranet)....and then click it ...My code is below but cant make it to work....Please help...


  • Re: Get URL from intranet link name...need help.


    Please don't cross post. It wastes community member's time. Sometimes it takes a lot of effort to provide a solution. When you cross post this effort is duplicated, which is very disrespectful to the people who are working on a solution....considering the question could very likely have already been answered on another forum.


    Try this:



    Note: I have posted the answer on the Mr. Excel Thread as well....

    Matt Mickle
    Using Excel 2010,2013 & 2016

  • Re: Get URL from intranet link name...need help.


    Hello... looks not working...it only open the site and do nothing,...really thankful for your continual support and understanding a newbie like me. Below is my code....pls help me check what went wrong...thanks




    The image below is the link name i want to click using vba....thanks a lot.



    [ATTACH=CONFIG]69218[/ATTACH]

  • Re: Get URL from intranet link name...need help.


    Change this section of code to this and report back:





    It's difficult to troubleshoot IE automation without html source code. Hopefully this helps you identify the issue, but I'm guessing it will just bring more questions.


    If you get the msgbox then your link is being found correctly and your click code is the issue....otherwise the find the Link portion of the code is wrong....


    If the click code is wrong maybe consider trying this:


    Code
    Set myLinks = ie.document.getElementsByTagName("a") 
        For Each mySingleLink In myLinks 
            If mySingleLink.innerText = "OT Claim Form (May 2016 Payroll)" Then 
            mysingleLink.Click
            End If 
        Next


    Cross Posted Here: http://www.mrexcel.com/forum/e…t-link-name-pls-help.html

    Matt Mickle
    Using Excel 2010,2013 & 2016

  • Re: Get URL from intranet link name...need help.


    Hello mrmmickle1...thanks a lot for the continual support...really owe you this if we can solve...i tried the code you recommended but it only open the intranet site and then do nothing....second code also got the same result...so i am sharing you the html code as per request, hope it can help...thanks a lot in advance.
    The flow is like this actually, every end of the month we open the intranet site and then click the download link of the over time form. The download link name is "OT Claim Form (May 2016 Payroll)" and keep changing the link name depends on the month. But let me handle on the changing names...The only think i need is how the vba excel code to automatic open the intranet and click the download link name...thanks


    Code
    <tr class="fliesstext " valign="top" bgcolor="#ffffff"><td width="5%" valign="top" style="vertical-align:top"></td>
    <td valign="top" style="width:412px;vertical-align:top"><div><a href="/location/place/place/20Form/OT_May_16.xls" target="_blank">OT Claim Form (May 2016 Payroll)</a></div></td></tr>
    <tr class="fliesstext " valign="top" bgcolor="#eeeeee"><td width="5%" valign="top" style="vertical-align:top"><span></span><span></span></td>
  • Re: Get URL from intranet link name...need help.


    Quote from mrmmickle1;771493

    Did the msgbox appear when you ran the first code snippet?


    Nope...it only open the intranet then nothing happen next.

  • Re: Get URL from intranet link name


    200yrs,


    You were told to add your link(s) to your post on other site(s) in an earlier post - something you have ignored and something that is a requirement of the forum. This thread is now locked to prevent wasting anyone else's time.


    Please have another read of the rules you agreed to upon joining OzGrid and ensure they are followed in future,


    Regards,


    S O

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!