VB关闭excel问题

momocom 2003-09-14 09:24:04
如何关闭所有已经运行了的excle

如何判断某sheet是否存在。如存在删掉该sheet(删掉的时候不出现那个提示框)。
...全文
79 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
easydone 2003-09-24
  • 打赏
  • 举报
回复
'删除多余的worksheet
'xlApp为Application对象(将Excel的警告去掉)
xlApp.DisplayAlerts = False
'xlBook为WorkBook对象
If xlBook.Worksheets.count > 1 Then
j = xlBook.Worksheets.count
xlApp.DisplayAlerts = False
For I = j To 2 Step -1
xlBook.Worksheets(I).Delete
Next I

End If
momocom 2003-09-20
  • 打赏
  • 举报
回复
胡来。。。。~~~~
sayboy 2003-09-20
  • 打赏
  • 举报
回复
c=.sheets.count
for i=1 to c
if .sheets(i).name="my name" then
'存在
end if
next
qifanghcy 2003-09-14
  • 打赏
  • 举报
回复
1、关闭EXCEL:
vb_Excel.Quit
Set vb_Excel=NOthing
2、判断某Sheet是否存在:
if vb_Excel.Sheets("Sheet1").Activate then '好像是这样吧,没试过,呵呵。。。
Sheets("Sheet1").Select
ActiveWindow.SelectedSheets.Delete
endif

2,461

社区成员

发帖
与我相关
我的任务
社区描述
VBA(Visual Basic for Applications)是Visual Basic的一种宏语言,是在其桌面应用程序中执行通用的自动化(OLE)任务的编程语言。
社区管理员
  • VBA
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧