Hi,

I am trying to do the following (for the moment):

1) Get path for files from hyperlinks in Excel spreadsheet
2) Correct path to refer to local path
3) Copy linked files into new folder structure, creating folders named by one column of the row containing the hyperlink (e.g. 01.01.2009/file1.txt -> d:\temp\columntitle\file1.txt)
4) Insert a remark if file was not found

I wrote the following code:

Sub fcopy()

Dim hLink As Hyperlink
Dim SourceRoot, TargetRoot, TargetPath, SourceFile, TargetFile As String

SourceRoot = "D:\Temp\Tima"
TargetRoot = "D:\timatarget\audio"

If Not FileOrDirExists(TargetRoot) Then
MkDir TargetRoot
End If

With ActiveSheet
For Each hLink In .Hyperlinks
TargetPath = TargetRoot & "\" & .Range("O" & ActiveCell.Row).Value
SourceFile = SourceRoot & "\" & hLink.Address
TargetFile = TargetPath & "\" & hLink.Name
SourceFile = Replace(SourceFile, "/", "\")
If FileOrDirExists(SourceFile) Then
If Not FileOrDirExists(TargetPath) Then
MkDir TargetPath
End If
filecopy SourceFile, TargetFile
.Range("AA" & ActiveCell.Row).Value = ""
Else
.Range("AA" & ActiveCell.Row).Value = "File missing"
End If
Next hLink
End With
End Sub
I worked on this code and it should be working. It loops through all hyperlinks, corrects the path, puts a remark and such. But somehow it doesn't work. Files are not being copied. Can somebody help please? Thanks in advance.

Greets,

|The_DUDE|