+ Reply to Thread
Results 1 to 12 of 12

Macro to open hyperlink and save the file

  1. #1
    Registered User
    Join Date
    06-03-2011
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    57

    Macro to open hyperlink and save the file

    Hi

    I have a excel spreadsheet which has 100's of hyperelinks in column H

    When I click on hyperlink it opens in Internet explorer and prompts the dialog to open save or cancel

    I have to save the each individual file eveytime and all these files are in Tiff format

    Can somebody help meacro for this

    thanks

  2. #2
    Forum Expert OllieB's Avatar
    Join Date
    12-20-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007 (home) & 2010 (office)
    Posts
    1,542

    Re: Macro to open hyperlink and save the file

    Create a module and copy & paste the code below

    Please Login or Register  to view this content.
    PS. You will need to amend the code somewhat to get the URL from the hyperlink. If you need further assistance please post a copy of the workbook
    If you like my contribution click the star icon!

  3. #3
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Macro to open hyperlink and save the file

    @OllieB,

    Code of URLDownloadToFile() is missing


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  4. #4
    Forum Expert OllieB's Avatar
    Join Date
    12-20-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007 (home) & 2010 (office)
    Posts
    1,542

    Re: Macro to open hyperlink and save the file

    Quote Originally Posted by :) Sixthsense :) View Post
    @OllieB,

    Code of URLDownloadToFile() is missing
    The URLDownloadToFile is a function in a Windows DLL. See the private declare statement just above the sub routine.

  5. #5
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Macro to open hyperlink and save the file

    Oops... Thanks for the info and correction

  6. #6
    Registered User
    Join Date
    06-03-2011
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    57

    Re: Macro to open hyperlink and save the file

    Hi Forum Guru,

    Thank you for providing this macro. I have pasted the hyperlinks in column A and pasted the name the file should be saved with in Column C.

    When I Execute this macro files are saved in the directory which I have choosed however the only problem I am facing is the files are not saved in Tiff format.

    The file type is shown as File and when I click the to open it prompts to select the file type to open the image and in turn I am selecting the Tiff format to open the file.

    Do we have a solution for this and one more quick question is instead of saving the file in default folder can we save the file by choosing the option to save (file save window option)

    Once again thanks for all your help

  7. #7
    Forum Expert OllieB's Avatar
    Join Date
    12-20-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007 (home) & 2010 (office)
    Posts
    1,542

    Re: Macro to open hyperlink and save the file

    The missing extension would occur when the file name provided in column C does not contain an extension. Either add the desired extension to the file name, or change the code to automatically append the ".tiff" to the file name. You specified having hundreds of hyperlinks, prompting where to save every single one does not make sense.

  8. #8
    Registered User
    Join Date
    06-03-2011
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    57

    Re: Macro to open hyperlink and save the file

    Excellent help on this thank you very much.

    One last request files are saved in default location, is there a possibility where I can choose the path to save the files like file open window this will help me alot

  9. #9
    Forum Expert OllieB's Avatar
    Join Date
    12-20-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007 (home) & 2010 (office)
    Posts
    1,542

    Re: Macro to open hyperlink and save the file

    You could introduce the following code in the solution to prompt you for the directory whether the objects should be saved

    Please Login or Register  to view this content.
    Note that you will have to declare strTargetFolder variable and use it in the call of URLDownloadToFile to replace the current constant used for the path value

  10. #10
    Registered User
    Join Date
    06-03-2011
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    57

    Re: Macro to open hyperlink and save the file

    Hi

    I am sorry but I could not understand how do I use the above code, as per the above note I have declare strTargetFolder, I am bit confused how do I use this , please advise

  11. #11
    Forum Expert OllieB's Avatar
    Join Date
    12-20-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007 (home) & 2010 (office)
    Posts
    1,542

    Re: Macro to open hyperlink and save the file

    Try

    Please Login or Register  to view this content.

  12. #12
    Forum Expert OllieB's Avatar
    Join Date
    12-20-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007 (home) & 2010 (office)
    Posts
    1,542

    Re: Macro to open hyperlink and save the file

    Try

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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