+ Reply to Thread
Results 1 to 2 of 2

VBA to create new folders based on cell value and click hyperlink

  1. #1
    Registered User
    Join Date
    07-20-2014
    Location
    phoenix,az
    MS-Off Ver
    200
    Posts
    22

    VBA to create new folders based on cell value and click hyperlink

    I posted an earlier thread, asking for help creating a macro that would create folders based on a value of a cell. This worked flawlessly, as seen below.

    What I need to do now, is download a large number of files that have hyperlinks in the rows from the folder list.

    Example:
    Column A (Location A) - Created a folder list using VBA below (can delete folders and start over if needed)
    Column C (https://hyperlink.com) - need to click and download the photo from the link, and save to the folder that was just created from column A
    Column H (https://hyperlink.com) - Not all rows will have this optional link to click, but if present, need to click-download-and save to folder.
    Will need to loop until completed for all rows.

    Any help is greatly appreciated.



    Public Function IsFolderExists(txt As String) As Boolean

    'returns true if the folder exists already, false if it does not.
    IsFolderExists = CreateObject("Scripting.FileSystemObject").FolderExists(txt)

    End Function

    Sub create_folders()
    'takes a folder name from the sheet in column A, and creates folder
    Dim myFile As String
    Dim myPath As String 'folder to test
    Dim myPaths 'to check each folder in the destination path
    Dim i As Long, j As Integer
    Dim ws As Worksheet 'sheet with data
    Dim lr As Long 'last row with data

    Set ws = Worksheets("Sheet1") 'change sheet name as needed
    lr = ws.Range("A" & Rows.Count).End(xlUp).Row 'last row with data in col A

    For i = 1 To lr
    myPath = "C:\Signage\" & ws.Range("A" & i).Value
    If Not IsFolderExists(myPath) Then
    CreateObject("Scripting.FileSystemObject").CreateFolder myPath
    End If
    Next i

    End Sub

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: VBA to create new folders based on cell value and click hyperlink

    Deleted my suggestion. It wouldn't work in this case.
    Last edited by AlphaFrog; 01-14-2019 at 01:15 AM.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

+ 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. [SOLVED] VBA to create new folders based on cell value
    By dharrier in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-09-2019, 03:37 PM
  2. [SOLVED] Vba code to search folders to find cell value and create hyperlink
    By sintek in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-16-2016, 01:56 AM
  3. [SOLVED] Code to create Folders and sub folders based on variable cell values
    By maxwell13 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 05-03-2015, 09:28 PM
  4. [SOLVED] Create folders and subfolder based on 2 cell values
    By Megatronixs in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-23-2015, 03:54 AM
  5. Macro to create folders based on content of a cell
    By CCPopsicle in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-24-2013, 10:42 AM
  6. [SOLVED] Automatically create hyperlink in active cell when creating folders
    By XxCMoneyxX in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-06-2013, 12:04 PM
  7. Create hyperlink to folders based on values in col A
    By Biinge in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-03-2012, 03:35 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