set oExcel = CreateObject( "Excel.Application" ) oExcel.Visible = false '4) 打开已存在的工作簿: oExcel.WorkBooks.Open( "C:Usersli.liuDesktop123.xlsx" ) On Error Resume Next '忽略错误 If oExcel.WorkSheets("Sheet2") Is Nothing Then MsgBox "不存在" oExcel.Worksheets.Add Else MsgBox "存在"
Vbs查找Excel中Sheet2工作表是否存在,不存在创建个新工作表