fix lỗi "the code in this project must be updated for use on 64-bit systems"

Liên hệ QC

thanhnam21

Thành viên mới
Tham gia
10/12/21
Bài viết
1
Được thích
0
em được anh chị chia sẻ cho VBA copy dữ liệu nhưng khi sử dụng báo lỗi này "the code in this project must be updated for use on 64-bit systems" mong tác giả hỗ trợ
 

File đính kèm

  • 1.xlsm
    22.7 KB · Đọc: 14
Phich với phọt.
Vần đề này ở đây nhiều lắm. Chịu khó tìm.
 
em được anh chị chia sẻ cho VBA copy dữ liệu nhưng khi sử dụng báo lỗi này "the code in this project must be updated for use on 64-bit systems" mong tác giả hỗ trợ
Code trong tập tin là của siwtom. siwtom nghỉ chơi rồi nên tôi chỉnh sửa cho bạn. Bạn thử sửa như sau.

1.Vứt Module2 đi. Tôi không hiểu ai thêm Module2 để làm gì.

2. Trong modCopyMoveDeleteFolder

2a. Giữ nguyên như cũ từ dòng Sub DeleteMoveFolder(...) tới cuối.

2b. Tất cả những gì trên dòng Sub DeleteMoveFolder(...) thì thay bằng
Mã:
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
 
Web KT

Bài viết mới nhất

Back
Top Bottom