例子: pclass.dll (ActiveX DLL ,类名称:class1) Public Function myFunction(ByVal i As Integer) As Integer myFunction= i End Function
主程序调用: Private Sub Command1_Click() On Error GoTo errorHandle: Dim obj As Object Set obj = CreateObject("pclass.class1") ''''pclass是DLL名称,class1是pclass.dll中的类名称 ''''注意:不是模块名称 MsgBox obj.myFunction(20) Set obj = Nothing Exit Sub errorHandle: MsgBox Err.Description & " -- 清检查DLL文件名称、类名称、是否注册等!" Err.Clear End Sub