2017-07-18 1294 views
0

我有一個非常大的用32位編寫的excel宏,需要轉換爲使用n excel 64位。有沒有簡單的方法來做這種轉換? 這是一個巨大的宏,不可能逐行轉換。將Excel宏從32位轉換爲64位

我已經包含下面的部分代碼。

'32-bit API declarations 
Declare Function SHGetPathFromIDList Lib "shell32.dll" _ 
    Alias "SHGetPathFromIDListA" (ByVal pidl As Long, ByVal pszPath As String) As Long 

Declare Function SHBrowseForFolder Lib "shell32.dll" _ 
    Alias "SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) As Long 

Sub DisplayDirectoryDialogBox() 
    Dim Msg As String 
    FileCount = 0 
    Msg = "Select a location containing the files you want to list." 
    SelectedDir = GetDirectory(Msg) 
    If SelectedDir = "" Then End 
    With Application 
     .StatusBar = "WAIT..." 
     .ScreenUpdating = False 
+0

手動添加'PtrSafe'到所有聲明。在表示'LongPtr'指針的聲明中手動轉換所有'Long'(在顯示的代碼中,這只是'pidl')。在作爲這些參數傳遞給'LongPtr'的過程中手動更新'Long'變量的聲明。沒有別的辦法。您可能試圖查看重構工具/插件,可以在一定程度上自動執行替換。 – GSerg

+0

謝謝。我會試試這個,讓你知道。 –

+0

@GSerg似乎工作正常。請把它放在答案框中,我接受它。謝謝。 –

回答

0

感謝Gserg:

手動添加PTRSAFE所有聲明。在表示指向LongPtrs的聲明中手動轉換所有Long(在顯示的代碼中,這將只是pidl)。在作爲這些參數傳遞給LongPtr的過程中手動更新Long變量的聲明。沒有別的辦法。您可能試圖查看重構工具/插件,可以在一定程度上自動執行替換。 - GSerg Jul 18 at 8:55