Kill ("EXCEL.EXE")'这里是调用
End Sub
Private Sub Kill(str As String)
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colProcessList = objWMIService.ExecQuery("Select * from Win32_Process Where Name='" & str & "'")
For Each objProcess In 键悄colProcessList
objProcess.Terminate '结束进吵高程
Next
Set objProcess = Nothing
Set colProcessList 稿碰渣= Nothing
Set objWMIService = Nothing
End Sub
Dim xlapp As Excel.Application 'Excel对象Dim xlbook As Excel.Workbook '工清备作簿
Dim xlsheet As 拆镇Excel.Worksheet '工作表
Dim xlrange As Excel.Range
'上面为公共变旅正粗量
Private Sub Command1_Click()
Set xlapp = CreateObject("excel.application") '第一层
Set xlbook = xlapp.Workbooks.Open("d:\123.xlsx")
xlapp.Visible = True
End Sub
Private Sub Command2_Click()
xlbook.Close
End Sub
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)