2012-10-22 1 views
0

그래서 Excel의 인스턴스를 시작하는 프로그램이 있습니다. 그것은 내 컴퓨터뿐만 아니라이 다른 사람의 컴퓨터에서 작동하지만, 내 프로젝트 리더를 시도 할 때, 그는 다음과 같은 오류 가져옵니다System.Runtime.InteropServices.COMException (0x80010108) vb.net 3.5 Excel 인스턴스를 만들 때

System.Runtime.InteropServices.COMException (0x80010108): Creating an instance of the COM component with CLSID {00024500-0000-0000-C000-000000000046} from the IClassFactory failed due to the following error: 80010108. 

아래 코드는 어디에서 나는 엑셀 인스턴스를 생성하고 시작 해요 .

Dim xlsApp As New Excel.Application 
    Dim xlsWB As Excel.Workbook 
    Dim xlsWS As Excel.Worksheet 

    Try 
     If ugLoadDeviationsDetails.DataSource IsNot Nothing Then 

      'Creates a temporary excel file with data located in the grid 
      UltraGridExcelExporter1.Export(ugLoadDeviationsDetails, "C:\ProgramData\Data-Tronics\ShellFiles\LoadDeviations\tempExcel") 

      xlsWB = xlsApp.Workbooks.Open("C:\ProgramData\Data-Tronics\ShellFiles\LoadDeviations\tempExcel") 

      xlsWS = DirectCast(xlsWB.Sheets("Sheet1"), Excel.Worksheet) 
      DirectCast(xlsWS.Cells.EntireRow, Excel.Range).ClearFormats() 
      DirectCast(DirectCast(xlsWS.Cells("1", "A"), Excel.Range).EntireRow().Cells, Excel.Range).Interior.Color = Color.LightGray.ToArgb 

      DirectCast(xlsWS, Excel.Worksheet).Copy() 

      xlsWB.Close(False) 

      xlsApp.Visible = True 
      xlsApp.UserControl = True 

     Else 
      RaiseEvent ShowError("Cannot write file when grid is empty.") 
     End If 
    Catch ex As Exception 

     For Each wb As Excel.Workbook In xlsApp.Workbooks 
      wb.Close(False) 
     Next 
     xlsApp.Quit() 
    Finally 
     xlsApp = Nothing 
     xlsWB = Nothing 
     xlsWS = Nothing 
    End Try 

는 다음 줄에 중단 스택 트레이스에 따르면 : 나는 (2010)처럼

Dim xlsApp As New Excel.Application 

프로젝트 리드의 Excel 동일한 버전을 사용, 사람에 관해서는 어떤 이유로 생각할 수 있습니다 왜 이런 일이 일어나고 어떻게 해결할 수 있을까요?

+0

중복 가능성 사용해 [COMException (0x80010108 - RPC \ _E \ _DISCONNECTED) Excel.Workbook를 닫으면 (http://stackoverflow.com/questions/2421188/comexception-0x80010108-rpc -e-disconnected-when-closing-excel-workbook) – paulsm4

+0

@ paulsm4 새로운 Excel.Application을 처음 만들 때, 그리고 지금까지 한 대의 컴퓨터에서만 발생하기 때문에 그렇게 생각하지 않습니다. 2 일 운전 거리). – Sai

+0

Excel이 시작되었지만 작별 인사를하지 않고 즉시 종료되었습니다. Office에 다시 설치하는 문제와 같은 문제가 있습니다. –

답변

0

xlsApp = CreateObject("Excel.Application") 
xlsBook = xlsApp.Workbooks.Add 
xlsSheet = xlsBook.Worksheets.Add