G Guest Jan 13, 2005 #1 Does anybody know of the best way to determine if a worksheet exists in an Excel workbook using VB.NET?
Does anybody know of the best way to determine if a worksheet exists in an Excel workbook using VB.NET?
R Ritesh Jain via DotNetMonster.com Jan 14, 2005 #2 Hi, This not optimize solution but u can try with this one.......... dim intCounter as integer Dim exlApp As New Excel.Application() Dim exlBook As Excel.Workbook = exlApp.Workbooks.Open("c:\datas.xls") For intCounter = 1 to exlBook.Worksheets.Count if exlBook.Worksheets.item(intCounter).name = "NameTobechekced" then messgebox.show("Sheet Exist") end if Next I hope this will help u............... Reagrds, Ritesh
Hi, This not optimize solution but u can try with this one.......... dim intCounter as integer Dim exlApp As New Excel.Application() Dim exlBook As Excel.Workbook = exlApp.Workbooks.Open("c:\datas.xls") For intCounter = 1 to exlBook.Worksheets.Count if exlBook.Worksheets.item(intCounter).name = "NameTobechekced" then messgebox.show("Sheet Exist") end if Next I hope this will help u............... Reagrds, Ritesh