タイトル : Excel間のシートコピーについて 投稿日 : 2008/11/17(Mon) 11:09 投稿者 : RICE
初めて投稿します。 Excelのシートを別のExcelシートにコピーしようとすると 「HRESULT からの例外: 0x800A03EC」のエラーが出力されます。 どなたかご教授をお願いいたします。 環境:VB.NET2005 + WindowsVISTA + Excel2007 ----------------------------------------------- Dim xlApp1 As New Microsoft.Office.Interop.Excel.Application Dim xlBooks1 As Microsoft.Office.Interop.Excel.Workbooks = xlApp1.Workbooks Dim xlFilePath1 As String = strExcelFilePath + "\" + strFirstFileNM Dim xlBook1 As Microsoft.Office.Interop.Excel.Workbook = xlBooks1.Open(xlFilePath1) Dim xlSheets1 As Microsoft.Office.Interop.Excel.Sheets = xlBook1.Worksheets Dim xlSheet1 As Microsoft.Office.Interop.Excel.Worksheet = CType(xlSheets1.Item(1), Microsoft.Office.Interop.Excel.Worksheet) Dim xlFilePath2 As String = strExcelFilePath + "\" + + strExcelFileName Dim xlBook2 As Microsoft.Office.Interop.Excel.Workbook = xlBooks1.Open(xlFilePath2) Dim xlSheets2 As Microsoft.Office.Interop.Excel.Sheets = xlBook2.Worksheets Dim xlSheet2 As Microsoft.Office.Interop.Excel.Worksheet = CType(xlSheets2.Item(1), Microsoft.Office.Interop.Excel.Worksheet) xlSheet2.Copy(After:=xlSheet1) '←エラー発生 xlBook1.Save() xlBook1.Close() xlBook2.Close() xlBooks1.Close() xlApp1.Quit() |