■No57620 (どめすと さん) に返信 別回答として SHFileOperation API を使用する。
・サンプル(テキストボックス×2、コマンドボタン×1) '--モジュール側 Public Declare Function SHFileOperation Lib "shell32.dll" Alias "SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As Long
Public Type SHFILEOPSTRUCT hwnd As Long wFunc As Long pFrom As String pTo As String fFlags As Integer fAnyOperationsAborted As Long hNameMappings As Long lpszProgressTitle As String End Type
Public Const FO_COPY As Long = &H2 Public Const FOF_MULTIDESTFILES = &H1
'-- Form側 Private Sub Command1_Click() Dim Ret As Long Dim SH As SHFILEOPSTRUCT
With SH .hwnd = Me.hwnd .wFunc = FO_COPY .pFrom = Text1.Text 'コピー元ファイル名 .pTo = Text2.Text 'コピー先ファイル名 .fFlags = FOF_MULTIDESTFILES End With