Create hyperlinks to all files in a folder-how to modify code found on site

  • Re: Create hyperlinks to all files in a folder-how to modify code found on site


    For example, if I use c:\folder\folder1\folder2 as the path, in column A1 it will start with c:\folder, column B1 will have c:\folder\folder 1 and column 2 c:\folder\folder1\folder2. I always end up deleting column A1/the top folder because there are no links.
    I was looking for VBA code to give me the hyperlinks of the folder path but to start with c:\folder\folder1 in A1 and so on.



    Quote from cytop;778272

    What do you mean by "No top folder"...?


    The listing has to start from somewhere.


    It does list the files into Column A.

  • Re: Create hyperlinks to all files in a folder-how to modify code found on site


    Quote

    I always end up deleting column A1/the top folder because...


    Then why not just add a single line to the existing code to delete column A when it finishes?

  • Re: Create hyperlinks to all files in a folder-how to modify code found on site


    I've tried a few times to delete column A and it's not working. What do I need to add to current code to remove column A after it finishes adding all the hyperlinks?


    Quote from cytop;778299

    Then why not just add a single line to the existing code to delete column A when it finishes?

  • Re: Create hyperlinks to all files in a folder-how to modify code found on site


    Quote

    I've tried a few times to delete column A and it's not working


    Deleting a column is simple - Post one or 2 examples of what you've tried.

  • Re: Create hyperlinks to all files in a folder-how to modify code found on site


    Quote from falcios;778313

    I've tried a few times to delete column A and it's not working. What do I need to add to current code to remove column A after it finishes adding all the hyperlinks?

    Simply delete column A whilst the macro recorder is running and add the generated code to the end of the main subroutine at http://www.ozgrid.com/forum/sh…75318&p=729296#post729296.


    However, rather than a kludge to delete the unwanted column(s), I have modified the existing code to start the listing at a specified folder level below the specified start folder. This new functionality is optional and the updated code below largely works the same as the previous code, if the optional startFolderLevel parameter is omitted. The only bug fix in the code below is to prepend an apostrophe " ' " if the folder or file name starts with "@" (without the apostrophe the cell value would be blank).


    I wanted to post this updated code in the original thread, since the new functionalilty is optional and it has the "@" fix, however that thread is locked.


Participate now!

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