Home > Software engineering >  Vb call DLL
Vb call DLL

Time:10-27

First: to direct input to excel in the main program in vb address is passed to the DLL code in the DLL can be calculated as below:
DLL code:
The Public Function shuju (the File As a String)
Dim I As an Integer, j As an Integer, M As an Integer, N, As an Integer
Dim xlApp As Excel. Application 'Excel import data, Excel objects'
Dim xlBook As Excel. The Workbook 'book'
Dim xlSheet As Excel. The Worksheet 'Worksheet'
Dim Filename, SheetName As String
Filename=File
SheetName="sheet1" 'table'
The Set xlApp=CreateObject (" Excel. Application ") 'create Excel object'
Set xlBook=xlApp. Workbooks. Open (Filename) 'Open existing EXCEL artifacts book file
The Set xlSheet=xlBook. Worksheets (SheetName) 'sets the active worksheet'
XlApp. Visible=True 'set the EXCEL object Visible'
Calculation need to return the two Numbers and two two-dimensional array (this step will not)
Vb main program: Private Declare Function sj Lib "PRJ. DLL" (ByVal File As Single)
Private Sub Form_Click ()
Dim the File As a String
Dim As Integer I
The File=Val (Text1. Text)
Dim M As an Integer, N As Integer
The Set z=CreateObject (" DRSJPRJ. Sjclass ")
Call z.s huju (File)
Also don't know how to receive send back number and array
End Sub
Please master action
  • Related