首页 > 解决方案 > 在 VBA 中使用 dll 中的函数时出现运行时错误 48?

问题描述

我必须在 VBA 代码中使用 DLL 文件。

在代码中声明后,我无法使用或调用该函数。错误是:file not found并且错误代码是runtime 48

我需要的帮助是知道如何调用和初始化 dll 中的函数。

Option Explicit

Public x As Integer

Private Declare Function XYZ Lib " H:\google drive\laser machine\software\Development\delete\squareDLL\x64\Debug\squareDLL.dll" (ByVal x As Double) As Double

Sub main()
    x = 20
    Call XYZ(x)
End Sub

标签: vbadllcoreldraw

解决方案


Option Explicit
Public x As Integer
Private Declare Function XYZ Lib " H:\google drive\laser machine\software\Development\delete\squareDLL\x64\Debug\squareDLL.dll" (ByVal x As Double) As Double

Sub main()
x = 20
Call XYZ(x)
End Sub

推荐阅读