回复 2楼 约定的童话
程序代码:
Private Sub Command4_Click()
Dim xlApp As Excel.Application '声明对象变量
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Dim OpenExecl As Long
Dim ExcelPath As String
Dim aaA As String
Dim Lane As Integer
Dim P As Integer
Dim HPHR As Integer
Lane = Val(LaneIO(0)) '定义高速框变量
P = Val(HPIO(1))
HPHR = Val(HPHRIO(2))
Set xlApp = CreateObject("Excel.Application") '创建EXCEL对象
Set xlBook = xlApp.Workbooks.Open("E:\WLR\VB\0913\Book1111.xls") '打开存在的execl文件
xlApp.Visible = False '设置EXCEL对象可见(或不可见)
Set xlSheet = xlBook.Worksheets("Sheet2") '设置活动工作表
xlSheet.Activate '激活工作表
RCOUNT = xlApp.ActiveSheet.UsedRange.Rows.Count
For j = 2 To RCOUNT Step 1
If Cells(j, 2).Value >= Lane And Cells(j, 4).Value >= P And Cells(j, 5).Value >= HPHR Then
aaA = aaA + " " + xlSheet.Cells(j, 1).Value & vbCrLf
End If
Text1.Text = aaA
Next
End Sub
大神帮忙给看下我调用EXCEL代码的过程,在WIN10里就访问不了