Private Declare PtrSafe Function GenerateActiveTypicalWorksheet Lib "C:\Program Files\EPLAN\EEC One\2.7.3\Platform64\W3ApiBase.dll" Alias "EecOne.GenerateActiveTypicalWorksheet" () As Integer
Call Application.Run("EecOne.GenerateActiveTypicalWorksheet")
End Function
Private Sub Workbook_Open()
GenerateActiveTypicalWorksheet
End Sub
我试图在.dll文件中调用一个函数,但出现错误“无效的外部过程”。
这是我要使用的dll / API的唯一可用文档:
还有:
答案 0 :(得分:2)
语法应如下所示:
Private Declare PtrSafe Function GenerateActiveTypicalWorksheet Lib "C:\Program Files\EPLAN\EEC One\2.7.3\Platform64\W3ApiBase.dll" Alias "EecOne.GenerateActiveTypicalWorksheet" () As Integer
Private Sub Workbook_Open()
GenerateActiveTypicalWorksheet
End Sub
请注意,Private Declare PtrSafe Function
就像对库中函数的引用一样。只是使其可用,没有源代码,也没有End Function
。它更像是函数的链接。
这里的问题是这两行……
Call Application.Run("EecOne.GenerateActiveTypicalWorksheet")
End Function
不在函数或过程中,因此出现错误……
无效的外部程序