【问题标题】:Converting Excel MAcro from 32 Bit to 64 Bit将 Excel MAcro 从 32 位转换为 64 位
【发布时间】:2017-07-22 09:26:58
【问题描述】:

我有一个相当大的 32 位 excel 宏,需要转换为使用 64 位的 n excel。有没有简单的方法来进行这种转换? 宏很大,不能逐行转换。

我在下面包含了部分代码。

'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

【问题讨论】:

  • 手动将PtrSafe 添加到所有声明中。在表示指向LongPtrs 的指针的声明中手动转换所有Longs(在显示的代码中,这将只是pidl)。在作为这些参数传递给LongPtr 的过程中手动更新Long 变量的声明。没有别的办法。您可以尝试研究可以在一定程度上自动化替换的重构工具/插件。
  • 谢谢。我会试试这个,让你知道。
  • @GSerg 似乎工作正常。请把它放在答案框中,我接受它。谢谢。

标签: excel vba


【解决方案1】:

感谢 Gserg:

手动将 PtrSafe 添加到所有声明中。手动转换声明中表示指向 LongPtrs 的指针的所有 Long(在显示的代码中,这将只是 pidl)。在作为这些参数传递给 LongPtr 的过程中手动更新 Long 变量的声明。没有别的办法。您可以尝试研究可以在一定程度上自动化替换的重构工具/插件。 – GSerg 7 月 18 日 8:55

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-01-22
    • 2014-09-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-06
    • 2012-07-26
    • 2021-03-16
    相关资源
    最近更新 更多