Hello,
I have the following problem and would appreciate any kind of assistance. I am new to VB / Makros (and that doesn't make things easier)
I have an excel sheet (MS Excel 2013). In one column I have all Hyperlinks to files in a folder. (different location than the excel workbook is saved)
D:\001 PROCESS DESCRIPTION\2313-00-T2-Z4 Rev 0.PDF
When I click on the hyperlink in the excel sheet it nicely opens this pdf. I now want to copy this file into a new folder.
Side comment: I have already ticked Microsoft Scripting runtime...
On the internet I have found the following Makro and put it into a Module: (nothing left out. Nothing up front or behind. Just this in a module and saved)
Public Sub CopyFile()
Dim objFSO As Object
Dim objFil As Object
Dim rngCell As Range
Const strNewDir As String = "C:\T\"
Set objFSO = CreateObject("Scripting.FileSystemObject")
On Error Resume Next
For Each rngCell In Selection
Set objFil = objFSO.GetFile(rngCell.Hyperlinks(1).Address)
objFil.Copy strNewDir
Next rngCell
On Error GoTo 0
End Sub
Unfortunately it does not work. It does not even create a folder on C called T. I did select a range of fields and was hoping that from this range the files would have been copied into the folder T on C.
Any clues how I can solve this what seems relative simple problem?
Thanks for your help and suggestions.
Bookmarks