Forum Discussion
ASV
13 years agoContributor
Hi Amy
I suggest you, if you need to know sheetname write in this way
Set objExcel = Sys.OleObject("Excel.Application")
objExcel.Workbooks.Open(strpathexcel)
Set objSheet = objExcel.ActiveWorkbook.Worksheets(1)
If objSheet.Name = "the name that you want" then
Log.Message("The sheetname is not exist")
End if
objExcel.DisplayAlerts = False
objExcel.ActiveWorkbook.SaveAs(strPathExcel)
objExcel.Workbooks.Close
objExcel.Application.Quit
Set objExcel = Nothing
I suggest you, if you need to know sheetname write in this way
Set objExcel = Sys.OleObject("Excel.Application")
objExcel.Workbooks.Open(strpathexcel)
Set objSheet = objExcel.ActiveWorkbook.Worksheets(1)
If objSheet.Name = "the name that you want" then
Log.Message("The sheetname is not exist")
End if
objExcel.DisplayAlerts = False
objExcel.ActiveWorkbook.SaveAs(strPathExcel)
objExcel.Workbooks.Close
objExcel.Application.Quit
Set objExcel = Nothing