Hi, i am trying to write a function in excel to copy a file from 1 location to another but seem unable to get it to work. here is my code, what am i missing 
Any help or advise would be greatly appreciated.
Regards
Lee
Any help or advise would be greatly appreciated.
Code:
Function CopySourceImages(ProductCode As String)
Dim sourceFile As String
Dim destinationFile As String
sourceFile = "/Users/admin/Desktop/Quidzin/Master Images/" & ProductCode & ".psd"
destinationFile = "/Users/admin/Desktop/Quidzin/Monthly Images/" & ProductCode & ".psd"
If FileOrFolderExists(sourceFile) Then
If Not FileOrFolderExists(destinationFile) Then
Dim ScriptToCopyFile As String
ScriptToCopyFile = "set sourceFileAlias" & " to " & Chr(34) & sourceFile & Chr(34) & " as alias" & Chr(13) & _
"set destinationFileAlias" & " to " & Chr(34) & destinationFile & Chr(34) & " as alias" & Chr(13) & _
"tell application " & Chr(34) & "finder" & Chr(34) & " duplicate " & sourceFileAlias & " to " & destinationFileAlias & " end tell"
MacScript (ScriptToCopyFile)
If FileOrFolderExists(destinationFile) Then
CopySourceImages = "Source File Exists, File Copied"
Else
CopySourceImages = "Source File Exists, Error Copying File"
End If
Else
CopySourceImages = "Destination File Exists, Skipped"
End If
Else
CopySourceImages = "Photo Needs Taking"
End If
End Function
Function FileOrFolderExists(FileOrFolderstr As String) As Boolean
Dim ScriptToCheckFileFolder As String
Dim TestStr As String
If Val(Application.Version) < 15 Then
ScriptToCheckFileFolder = "tell application " & Chr(34) & "System Events" & Chr(34) & "to return exists disk item (" & Chr(34) & FileOrFolderstr & Chr(34) & " as string)"
FileOrFolderExists = MacScript(ScriptToCheckFileFolder)
Else
On Error Resume Next
TestStr = Dir(FileOrFolderstr, vbDirectory)
On Error GoTo 0
If Not TestStr = vbNullString Then FileOrFolderExists = True
End If
End Function
Regards
Lee