Results 1 to 6 of 6

Macro to Hyperlink Command Button to open Selected Folders From a List Box

Threaded View

zaska Macro to Hyperlink Command... 01-21-2015, 03:04 PM
zaska Re: Macro to Hyperlink... 01-21-2015, 10:22 PM
xladept Re: Macro to Hyperlink... 01-22-2015, 12:19 AM
zaska Re: Macro to Hyperlink... 01-22-2015, 02:24 PM
xladept Re: Macro to Hyperlink... 01-22-2015, 08:17 PM
zaska Re: Macro to Hyperlink... 01-22-2015, 11:05 PM
  1. #1
    Forum Contributor
    Join Date
    06-20-2012
    Location
    India
    MS-Off Ver
    Office 365
    Posts
    454

    Macro to Hyperlink Command Button to open Selected Folders From a List Box

    Hello,

    I need some help in the following scenario.

    I have Three Main Folders say X,Y,Z In "D" Drive and i want to

    1. Select the main Folder using Option button....say X

    2. Show the list of Subfolders in the above Selected Folder (i.e) X in a listbox.

    3. Hyperlink the path of the selected subfolder from the listbox to a command button.

    4. Click the command button to open the Selected subfolder

    I am using the below macro to get the path list

    Dim iRow
    
    Sub ListFiles()
        iRow = 11
        Call ListMyFiles(Range("C7"), Range("C8"))
    End Sub
    
    Sub ListMyFiles(mySourcePath, IncludeSubfolders)
        Set MyObject = New Scripting.FileSystemObject
        Set mySource = MyObject.GetFolder(mySourcePath)
        On Error Resume Next
        For Each myFile In mySource.Files
            iCol = 2
            Cells(iRow, iCol).Value = myFile.Path
            iCol = iCol + 1
            Cells(iRow, iCol).Value = myFile.Name
            iCol = iCol + 1
            Cells(iRow, iCol).Value = myFile.Size
            iCol = iCol + 1
            Cells(iRow, iCol).Value = myFile.DateLastModified
            iRow = iRow + 1
        Next
        If IncludeSubfolders Then
            For Each mySubFolder In mySource.SubFolders
                Call ListMyFiles(mySubFolder.Path, True)
            Next
        End If
    End Sub
    I am herewith attaching the sample file.

    Thanking you.

    Regards,
    Zaska
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] open a hyperlink by command button
    By grkchakri in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-15-2014, 11:29 AM
  2. [SOLVED] Command button grayed out till option button selected
    By Jeff121 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-25-2013, 11:00 AM
  3. Open a document from a Combo Box drop down list with a Command Button.
    By Ortz in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-22-2012, 02:34 PM
  4. Can A Custom Command Button Have A Macro AND Hyperlink Assigned To It
    By fdegree in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 02-28-2012, 07:43 PM
  5. [SOLVED] command button:Can i use a command button to open diffrrent sheets
    By Hellboy in forum Excel General
    Replies: 0
    Last Post: 11-03-2005, 11:00 AM

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