Option Explicit
#If VBA7 Then
Private Type SHFILEOPSTRUCT
hwnd As LongPtr
wFunc As Long
pFrom As String
pTo As String
fFlags As Integer
fAborted As Long
hNameMaps As LongPtr
sProgress As String ' only used if FOF_SIMPLEPROGRESS
End Type
Private Declare PtrSafe Function MoveFile Lib "kernel32" Alias "MoveFileA" (ByVal lpExistingFileName As String, ByVal lpNewFileName As String) As Long
Private Declare PtrSafe Function SHFileOperation Lib "shell32.dll" Alias "SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As Long
#Else
Private Type SHFILEOPSTRUCT
hwnd As Long
wFunc As Long
pFrom As String
pTo As String
fFlags As Integer
fAborted As Long
hNameMaps As Long
sProgress As String
End Type
Private Declare Function MoveFile Lib "kernel32.dll" Alias "MoveFileA" (ByVal lpExistingFileName As String, ByVal lpNewFileName As String) As Long
Private Declare Function SHFileOperation Lib "shell32.dll" Alias "SHFileOperationA" (ByRef lpFileOp As SHFILEOPSTRUCT) As Long
#End If
Private Const FOF_NOCONFIRMATION As Long = &H10
Private Const FOF_NOCONFIRMMKDIR As Long = &H200
Private Const FO_MOVE As Long = &H1
Private Const FO_DELETE As Long = &H3
Private Const FO_COPY As Long = &H2
Private Const FOF_ALLOWUNDO As Long = &H40