EXCEL工作簿名与表名是变量的问题
用一个循环判断一系列工作簿,一系列表是否存在的语句:
dim shtname as worksheetset shtname = xlsapp.Workbooks(Kitting.WO.text & "-" & Sdept(n) & ".xls").sheets(ModSeled(t)) '这段代码有误 'e.g.: Kitting.WO.text & "-" & Sdept(n) & ".xls" = "123456-TE50.xls" ModSeled(t) = "LPT 50X"If IsNull(shtname)=False then '这里无法判断...end if
On Error Resume NextDim shtname As WorksheetSet shtname = NothingSet shtname = xlsapp.Workbooks(Kitting.WO.Text & "-" & Sdept(n) & ".xls").Sheets(ModSeled(t))'这段代码有误'e.g.: Kitting.WO.text & "-" & Sdept(n) & ".xls" = "123456-TE50.xls" ModSeled(t) = "LPT 50X"If shtname Is Nothing Then '这里无法判断 MsgBox ("Sheets:" & ModSeled(t) & "不存在")End If