下面是我的程序,我用了一个Button控件,来判断Excel表中的一个项的值,可是Excel的进程在程序完成后不知该如何关闭 Private Sub check(xlsname) Set bbDy = CreateObject("excel.application") With bbDy .workbooks.Open App.Path & "\" & xlsname & ".xls" .Visible = False With .sheets(1) If .cells(1, 6).Value <> "a" Then MsgBox "" & xlsname & "" End If End With End With End Sub Private Sub Command1_Click() i = 1 Do Until i = 5check Trim(i) i = i + 1 Loop End Sub
你可以用kill excel(你具体再谢谢),先要判断一下
Private Sub check(xlsname)
Set bbDy = CreateObject("excel.application")
With bbDy
.workbooks.Open App.Path & "\" & xlsname & ".xls"
.Visible = False
With .sheets(1)
If .cells(1, 6).Value <> "a" Then
MsgBox "" & xlsname & ""
End If
End With
End With
End Sub
Private Sub Command1_Click()
i = 1
Do Until i = 5check Trim(i)
i = i + 1
Loop
End Sub
set bbDy =nothing