screechowl Posted July 15, 2003 Posted July 15, 2003 I'm having trouble with the Excel Chart object. Does anyone know how to properly create one? The following code works; however, the Excel process hangs. If I comment out the Chart object, then the process does not hang. Dim xlApp As New Excel.Application() xlApp.Visible = True xlApp.DisplayAlerts = False xlApp.UserControl = False Dim xlWrkbks As Excel.Workbooks = xlApp.Workbooks Dim xlWrkbk As Excel.Workbook = xlWrkbks.Add Dim xlWrkst As Excel.Worksheet xlWrkst = xlApp.ActiveSheet() Dim xlChartObj As Excel.Chart = xlWrkbk.Charts.Add System.Runtime.InteropServices.Marshal.ReleaseComObject(xlChartObj) xlChartObj = Nothing System.Runtime.InteropServices.Marshal.ReleaseComObject(xlWrkst) xlWrkst = Nothing xlWrkbk.Close() System.Runtime.InteropServices.Marshal.ReleaseComObject(xlWrkbk) xlWrkbk = Nothing xlWrkbks.Close() System.Runtime.InteropServices.Marshal.ReleaseComObject(xlWrkbks) xlWrkbks = Nothing xlApp.Quit() System.Runtime.InteropServices.Marshal.ReleaseComObject(xlApp) xlApp = Nothing GC.Collect() GC.WaitForPendingFinalizers() Quote
Recommended Posts