I wrote a VB app that reads data from the COM ports and puts it into an array. Then it dumps the data to excel. When I'm done and want to view the data, I double-click the file and Excel doesn't fully launch. If I close my program, then it works. No matter what I try, unless my VB app is closed, any of the files that were created by my app won't load. Here's the parts of my code that have references to creating an Excel object.
What do I have to add so I don't have to close my app first to view my data? The only thing I have in the Form_Unload is:Code:Dim objExcel As New Excel.Application Dim objBook As New Excel.Workbook dlgCommon.DialogTitle = "Save Data to File" dlgCommon.Filter = "Excel Files(*.xls)|*.xls" dlgCommon.ShowSave Filename = dlgCommon.Filename Set objBook = objExcel.Workbooks.Add objExcel.Cells(1, 1) = "Force" objExcel.Cells(2, 1) = "(" & lblUnits.Caption & ")" objExcel.Cells(1, 3) = Date objExcel.Range("C:C").ColumnWidth = 9.5 For i = 1 To Index objExcel.Cells(i + 3, 1) = DataArray(i) Next i
objExcel.Quit
Which doesn't seem to make a difference.




Reply With Quote