VBA Excel DLL - 错误48

时间:2017-04-29 00:39:28

标签: excel vba excel-vba dll

我最近获得了一个基于2003 Office版本的VBA代码,基于32位。我只有64位Office 2016,我将代码更新到下面 - 但是当我运行宏时,我得到一个"运行时错误 - 找不到文件" Swings4-2.dll"。即使我删除文件扩展名,仍然会弹出错误。 DLL文件与XLS / XLSM文件位于同一目录中,即使我引用该文件的完整目录 - 它仍然会给我一个错误。

#If VBA7 And Win64 Then
    Private Declare PtrSafe Sub Swings Lib "Swings4-2.dll" (ByRef Par1 As Integer, ByRef Par2 As Integer, _
       ByRef Par3 As Single, ByRef Par4 As Single, ByRef Par5 As Single, ByRef Par6 As Single, _
       ByRef Par7 As Single, ByRef Par8 As Single, ByRef Par9 As Single, ByRef Par10 As Single, _
       ByRef Par11 As Single, ByRef Parl2 As Single, ByRef Parl3 As Single, ByRef Parl4 As Single)
#Else
    Private Declare Sub Swings Lib "Swings4-2.dll" (ByRef Par1 As Integer, ByRef Par2 As Integer, _
       ByRef Par3 As Single, ByRef Par4 As Single, ByRef Par5 As Single, ByRef Par6 As Single, _
       ByRef Par7 As Single, ByRef Par8 As Single, ByRef Par9 As Single, ByRef Par10 As Single, _
       ByRef Par11 As Single, ByRef Parl2 As Single, ByRef Parl3 As Single, ByRef Parl4 As Single)
#End If

非常感谢帮助

1 个答案:

答案 0 :(得分:0)

您似乎在为您的dll使用非标准名称。

  

有时,DLL过程的名称不合法   标识符。它可能有一个无效的字符,如连字符。什么时候   在这种情况下,使用Alias关键字指定非法   程序名称。

有关详细信息,请参阅this article