+ Reply to Thread
Results 1 to 12 of 12

vba macro to open a link and save the new link in excel

  1. #1
    Forum Contributor
    Join Date
    11-10-2017
    Location
    INDIA
    MS-Off Ver
    365
    Posts
    184

    vba macro to open a link and save the new link in excel

    Hi All,
    I have a links in a column A and new link to be copied in column B.

    I just want that, a macro should open the link provided in chrome and when the page loads, it should copy the link page after loading and paste in the next column .

    eg.
    https://support.hp.com/in-en/search?...38Z00X&filter=

    if you open the above link it will redirect to the below link

    https://support.hp.com/in-en/product...57?sku=2MB48PA

    I have link in column "A" and require the final link in column "B".

    Thanks, any help would be appreciated.
    Attached Files Attached Files

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: vba macro to open a link and save the new link in excel

    Hi Sunny,

    Using Excel, I expect you can open a hyperlink to the default browser. I'm not sure you can specify which browser will fire, if you have multiple browsers installed on your computer. Then the control of the OS is in the browser and you would need to copy the URL from the browser window and copy it into the windows Copy buffer and then go back to Excel and Paste the URL into the same row using the B column.

    I simply don't know how to do the above process. The whole time you are using Excel VBA. I do know that while in Excel you can use "DoEvents" which will allow the OS to do other things before it comes back to Excel and this might be part of your problem. I don't use Chrome (I'm an Edge guy) and can't even try it.

    Sorry - perhaps this answer will bump this thread and another user will have an answer for you.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Valued Forum Contributor Sean Thomas's Avatar
    Join Date
    03-25-2012
    Location
    HerneBay, Kent, UK
    MS-Off Ver
    Excel 2007,2016
    Posts
    971

    Re: vba macro to open a link and save the new link in excel

    Never done anything with Chrome, but I found this - maybe the reason why not much about it

    Google Chrome does not provide a Visual Basic interface like Internet Explorer does, so you cannot access any of it's properties (e.g. Document). You can launch chrome at a specific address just by passing to the executable.

    For example:
    Please Login or Register  to view this content.

    Apparently there's an excellent resource library called Selenium that has VBA Wrappers

    http://www.makeuseof.com/tag/how-to-...-and-selenium/
    Regards
    Sean

    Please add to my reputation if you think i helped
    (click on the star below the post)
    Mark threads as "Solved" if you have your answer
    (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code:
    [code] Your code here [code]
    Please supply a workbook containing example Data:
    It makes its easier to answer your problem & saves time!

  4. #4
    Forum Contributor
    Join Date
    11-10-2017
    Location
    INDIA
    MS-Off Ver
    365
    Posts
    184

    Re: vba macro to open a link and save the new link in excel

    Quote Originally Posted by Sean Thomas View Post
    Never done anything with Chrome, but I found this - maybe the reason why not much about it

    Google Chrome does not provide a Visual Basic interface like Internet Explorer does, so you cannot access any of it's properties (e.g. Document). You can launch chrome at a specific address just by passing to the executable.

    For example:
    Please Login or Register  to view this content.

    Apparently there's an excellent resource library called Selenium that has VBA Wrappers

    http://www.makeuseof.com/tag/how-to-...-and-selenium/
    Thanks Sean,
    I would appreciate if you could help me copy the url in excel. Using IE if possible, Kindly help with the code for same.
    opening multiple browser would cost memory, it could be reduced by opening a browser once and next open the link in new tab to save memory.

    Help me how can I fetch the link back in excel sheet.

  5. #5
    Forum Contributor
    Join Date
    11-10-2017
    Location
    INDIA
    MS-Off Ver
    365
    Posts
    184

    Re: vba macro to open a link and save the new link in excel

    Quote Originally Posted by MarvinP View Post
    Hi Sunny,

    Using Excel, I expect you can open a hyperlink to the default browser. I'm not sure you can specify which browser will fire, if you have multiple browsers installed on your computer. Then the control of the OS is in the browser and you would need to copy the URL from the browser window and copy it into the windows Copy buffer and then go back to Excel and Paste the URL into the same row using the B column.

    I simply don't know how to do the above process. The whole time you are using Excel VBA. I do know that while in Excel you can use "DoEvents" which will allow the OS to do other things before it comes back to Excel and this might be part of your problem. I don't use Chrome (I'm an Edge guy) and can't even try it.

    Sorry - perhaps this answer will bump this thread and another user will have an answer for you.
    Thanks for your response,
    I would also not prefer chrome browser but if possible with IE then I don't have any issue , I fail to copy back the link in excel.

  6. #6
    Valued Forum Contributor Sean Thomas's Avatar
    Join Date
    03-25-2012
    Location
    HerneBay, Kent, UK
    MS-Off Ver
    Excel 2007,2016
    Posts
    971

    Re: vba macro to open a link and save the new link in excel

    Every time I try that site it shows an error - possibly site is down for some reason.
    What have you tried so far?

  7. #7
    Forum Contributor
    Join Date
    11-10-2017
    Location
    INDIA
    MS-Off Ver
    365
    Posts
    184

    Re: vba macro to open a link and save the new link in excel

    Quote Originally Posted by Sean Thomas View Post
    Every time I try that site it shows an error - possibly site is down for some reason.
    What have you tried so far?
    Hi Sean,
    The link is down, But there are other links in the file.
    you may try this one

    https://support.hp.com/in-en/search?...38Z02N&filter=
    the result link is
    https://support.hp.com/in-en/product...57?sku=2MB48PA

    The other cause may be because of the country.
    If the above link doe not works follow the below process:
    1.Open the link below
    https://support.hp.com/in-en/products
    2.Enter the product number INA738Z02N in the search box and hit Find.
    Capture.PNG
    3.Now the final link is required in the sheet.

  8. #8
    Valued Forum Contributor Sean Thomas's Avatar
    Join Date
    03-25-2012
    Location
    HerneBay, Kent, UK
    MS-Off Ver
    Excel 2007,2016
    Posts
    971

    Re: vba macro to open a link and save the new link in excel

    this will get you started.
    However some of the websites cause a few issues loading

    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    11-10-2017
    Location
    INDIA
    MS-Off Ver
    365
    Posts
    184

    Re: vba macro to open a link and save the new link in excel

    Quote Originally Posted by Sean Thomas View Post
    this will get you started.
    However some of the websites cause a few issues loading

    Please Login or Register  to view this content.
    Thanks a lot, this has been so helpful to me.
    If any more modification is required will approach you.

  10. #10
    Forum Contributor
    Join Date
    11-10-2017
    Location
    INDIA
    MS-Off Ver
    365
    Posts
    184

    Re: vba macro to open a link and save the new link in excel

    Hello,

    This is doing well but consuming lot of memory, could you check weather the IE is already open or not.
    If already open, can we search the link by opening the link in new tab and then close the tab.
    Instead of opening a new browser and closing it every time.

  11. #11
    Forum Contributor
    Join Date
    11-10-2017
    Location
    INDIA
    MS-Off Ver
    365
    Posts
    184

    Re: vba macro to open a link and save the new link in excel

    Thanks You.

  12. #12
    Valued Forum Contributor Sean Thomas's Avatar
    Join Date
    03-25-2012
    Location
    HerneBay, Kent, UK
    MS-Off Ver
    Excel 2007,2016
    Posts
    971

    Re: vba macro to open a link and save the new link in excel

    Hi
    it will take some memory up

    you are opening a webpage, waiting for it to divert to the one you want to get the url for. But before you can do that you have to wait until it finishes loading

    you could try this

    Please Login or Register  to view this content.
    This will keep the ie open until its finished. although i had a few issues with it, that's why I closed the ie each time

+ 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. Replies: 2
    Last Post: 11-11-2017, 07:40 AM
  2. Macro to work on HTML and to click on a link and save the excel exported
    By IonutC in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-14-2016, 10:22 AM
  3. Open xls file via URL link, and automatically filter on a switch or value in the link?
    By linksavage in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-13-2013, 02:27 PM
  4. Macro to link tab and save files
    By JoeNK in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-11-2012, 06:55 PM
  5. open link in cell; save pdf in a different location
    By rkiser in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-08-2012, 06:56 PM
  6. Link only works when link workbook is open
    By carsto in forum Excel General
    Replies: 4
    Last Post: 05-08-2009, 09:03 AM
  7. Open, allow link updates, and Save
    By CLR in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-10-2005, 06:24 AM

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