VBA lỗi 64 bit giúp em với!!! lỗi Please review and update Declare statements and then mark them with the PtrSafe attribute

Liên hệ QC

Mc2296

Thành viên mới
Tham gia
25/4/21
Bài viết
2
Được thích
0
em bị lỗi 64 bit khi nhận được file của một người gửi em. hiện lỗi The code in this project must be updated for use on 64-bit systems. Please review and update Declare statements and then mark them with the PtrSafe attribute. giúp em sửa với ạ. em sử dụng excel 16. e k biết gì nhiều về VBA.
 

File đính kèm

  • COPY THEO DANH SACH (1).xlsm
    49.9 KB · Đọc: 11
Thay
Mã:
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" (lpFileOp As SHFILEOPSTRUCT) As Long
bằng
Mã:
#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
    End Type
#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
#End If
...
#If VBA7 Then
    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 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" (lpFileOp As SHFILEOPSTRUCT) As Long
#End If
 
CÁM ƠN CÁC ANH RẤT NHIỀU.
 
Web KT
Back
Top Bottom