vb调用dll
第一个:想直接在vb的主程序里输入excel的地址 传递给dll dll里就可以计算 代码如下:dll代码:
Public Function shuju(File As String)
Dim i As Integer, j As Integer, M As Integer, N As Integer
Dim xlApp As Excel.Application 'excel导入数据,Excel对象'
Dim xlBook As Excel.Workbook '工作簿'
Dim xlSheet As Excel.Worksheet '工作表'
Dim Filename, SheetName As String
Filename = File
SheetName = "sheet1" '表名'
Set xlApp = CreateObject("Excel.Application") '创建EXCEL对象'
Set xlBook = xlApp.Workbooks.Open(Filename) '打开已经存在的EXCEL工件簿文件'
Set xlSheet = xlBook.Worksheets(SheetName) '设置活动工作表'
xlApp.Visible = True '设置EXCEL对象可见'
进行计算 需要返回两个数 和两个二维数组(这步也不会)
vb主程序:Private Declare Function sj Lib "prj.dll" (ByVal File As Single)
Private Sub Form_Click()
Dim File As String
Dim i As Integer
File = Val(Text1.Text)
Dim M As Integer, N As Integer
Set z = CreateObject("drsjprj.sjclass")
Call z.shuju(File)
也不知道怎么接收传递回来的数和数组
End Sub
请大侠支招 vb dll --------------------编程问答-------------------- 除
补充:VB , 控件