Dear All,
would you please provide some code which lists all today changed Excel files on the C drive and hyperlink them.
Thank you very much in advance.
Best regards,
Wolfgang
Dear All,
would you please provide some code which lists all today changed Excel files on the C drive and hyperlink them.
Thank you very much in advance.
Best regards,
Wolfgang
Hi..
Here's one way... click the "Go!" button in the attached file..
* Select the Folder you want to scan with the Folder picker. Subfolders will be scanned also..
* Results will show in Column A and B.
Private Sub CommandButton1_Click() Dim Z, ZZ, i As Long, ii As Long, SelFold As String, fldr As FileDialog, ShortName As String Set fldr = Application.FileDialog(msoFileDialogFolderPicker) With fldr .Title = "Select a Folder" If .Show <> -1 Then Exit Sub SelFold = .SelectedItems(1) End With ShortName = CreateObject("Scripting.FileSystemObject").getfolder(SelFold).ShortName Z = Split(CreateObject("wscript.shell").exec("cmd /c forfiles /P " & ShortName & " /S /d +0 /M *.xls* /c ""cmd /c echo @file ! @path""").stdout.readall, vbCrLf) With Cells(1, 1).Resize(1, 2) .Value = Array("Filename", "Link") .Font.Bold = True End With If UBound(Z) <> -1 Then For i = LBound(Z) To UBound(Z) If Z(i) <> vbNullString Then ZZ = Split(Replace(Replace(Z(i), vbCrLf, ""), """", ""), "!") For ii = 0 To UBound(ZZ) Step 2 Range("A" & Range("A" & Rows.Count).End(xlUp).Row).Offset(1).Value = Mid(ZZ(ii), 2) ActiveSheet.Hyperlinks.Add Range("B" & Range("B" & Rows.Count).End(xlUp).Row).Offset(1), Mid(ZZ(ii + 1), 2) Next ii End If Next i Columns("A:B").AutoFit MsgBox "Done!" Else MsgBox "No Files Found!" End If End Sub
Good Morning,
runs just fine.
Thank you very much and have a nice Sunday.
Best regards,
Wolfgang
You're welcome.. thanks for the feedback.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks