Declare Function SHFileOperation Lib "shell32.dll" Alias "SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As LongSHFileOperation, Kod
Public Type SHFILEOPSTRUCT
hwnd As Long
wFunc As Long
pFrom As String
pTo As String
fFlags As Integer
fAborted As Boolean
hNameMaps As Long
sProgress As String
End Type
Public Function ShellCopy(FileSource As String, FileDestination As String) As Long
Dim sFileNames As Variant
Dim Dick As String
Dim SHFileOp As SHFILEOPSTRUCT
Dim lngReturn As Long
sFileNames = FileSource & vbNullChar
sFileNames = sFileNames & vbNullChar
Dick = FileDestination
With SHFileOp
.wFunc = &H1
.pFrom = sFileNames
.fFlags = &H100 '&H4
.pTo = Dick
End With
'** det är här Err.LastDllError = 6 Overflow dyker upp
ShellCopy = SHFileOperation(SHFileOp)
End Function