vb.net 批量关闭excel 关闭指定excel

Try
Dim myabc As Object
myabc = System.Runtime.InteropServices.Marshal.GetActiveObject("excel.Application")
For i = 0 To myabc.Application.Workbooks.Count - 1
MsgBox(myabc.Application.Workbooks(1).name)'可以通过文件名判断关闭指定excel
myabc.Application.Workbooks.close
Next
' Process.GetProcesses("excel.exe")(0).Kill()
Catch ex As Exception
MsgBox(ex.Message)
End Try
转载请注明出处:

转载自http://lxfamn.cn/blog

未经允许不得转载:lxfamn » vb.net 批量关闭excel 关闭指定excel

赞 (0) 打赏

置顶推荐

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏