cerr Posted January 31, 2003 Posted January 31, 2003 (edited) I have a program were I take in data from an excel file and do some basic processing and generate an output file in Excel. The code seems to run ok, but I am not sure if I have a bug. The problem is while the application is running, I cannot open any Excel files (whether or not they are used in the code). Excel itself will load, but the worksheets associated within the file do not. So basically I see the top section (file menu, toolbars, ect) but the space were the worksheets are supposed to be does not load. I saw Gizmo's earlier post and have done the following in my code: This section reads data from excel Dim Xl As New Excel.Application() Dim Xlb As Excel.Workbook = Xl.Workbooks.Open(fileName) Dim Xls As Excel.Worksheet = CType(Xlb.Worksheets(workshtName), Excel.Worksheet) 'search for and collect data by looking for cells with flag set .... Xlb.Close(False) Xl.Application.Quit() Xl = Nothing Xlb = Nothing Xls = Nothing Here is a section of code that writes data to excel Dim xlApp As Excel.Application Dim xlBook As Excel.Workbook Dim xlSheet As Excel.Worksheet xlApp = CType(CreateObject("Excel.Application"), Excel.Application) xlBook = CType(xlApp.Workbooks.Add, Excel.Workbook) xlSheet = CType(xlBook.Worksheets(1), Excel.Worksheet) 'Insert data into excel .... xlSheet.SaveAs(qstExtractFile) xlBook.Close() xlApp.Quit() xlApp = Nothing xlBook = Nothing xlSheet = Nothing Is there a bug in my code, or is this the way VB is? I would appreciate it if anyone could shed some light on this. -Thnxs ps. Don't know if this makes any difference, but the program is not multi-threaded and rebooting seems to resolve the issue temorarily. At least until I start the app again. Edited January 31, 2003 by cerr Quote
Moderators Robby Posted January 31, 2003 Moderators Posted January 31, 2003 hmmm, I have seen Excel do a step-through (excel object) and then open a new session from the desktop. This is weird.... Quote Visit...Bassic Software
cerr Posted February 2, 2003 Author Posted February 2, 2003 Is there anything I can do to help debug this? Quote
Recommended Posts