すみません。 VB.netにもQuitの後に9秒タイマーを入れていました。 VBSも9秒にしたら10/10回はOKでした。 タイマーでなく、もっと確実に開放する方法にしたいのですが、どなたか 良いアイデアがありませんか? ------------ 改善VB.net(今のターゲット環境ではExcelは残らない) ----------- Private Sub Button1_Click Dim oExcel As Object Dim oBooks As Object Dim oBook As Object Dim oSheet As Object Dim oSheets As Object Dim oRange As Object Try 'Excel起動 oExcel = CreateObject("Excel.Application") oBooks = oExcel.Workbooks oBook = oBooks.Add '仮データ入力 oSheets = oBook.Sheets oSheet = oSheets.item(1) oRange = oSheet.Range("A1") oRange.Value = "hoge" 'Excel保存し終了 System.Runtime.InteropServices.Marshal.ReleaseComObject(oRange) System.Runtime.InteropServices.Marshal.ReleaseComObject(oSheet) System.Runtime.InteropServices.Marshal.ReleaseComObject(oSheets) oExcel.DisplayAlerts = False oBook.SaveAs("c:\Book1.xls") oBook.close() System.Runtime.InteropServices.Marshal.ReleaseComObject(oBook) System.Runtime.InteropServices.Marshal.ReleaseComObject(oBooks) oExcel.Quit() System.Threading.Thread.Sleep(9000) System.Runtime.InteropServices.Marshal.ReleaseComObject(oExcel) Catch ex As Exception MsgBox(ex.Message) End Try
- Child Tree -