vbs查找Excel中的Sheet2工作表是否存在不存在新建

set oExcel = CreateObject( "Excel.Application" )
oExcel.Visible = false
'4) 打开已存在的工作簿:
oExcel.WorkBooks.Open( "C:\Users\li.liu\Desktop\123.xlsx" )

On Error Resume Next '忽略错误
If oExcel.WorkSheets("Sheet2") Is Nothing Then
    MsgBox "不存在"
    oExcel.Worksheets.Add
Else MsgBox "存在"

Vbs查找Excel中Sheet2工作表是否存在,不存在创建个新工作表

posted @ 2017-08-24 16:26  LLSix  阅读(1119)  评论(0编辑  收藏  举报