Exception from HRESULT: 0x80010100 (RPC_E_SYS_CALL_FAILED)

Hi All,

I received similar message:

“message”: “Invoke VBA: Unable to cast COM object of type ‘System.__ComObject’ to interface type ‘Microsoft.Office.Interop.Excel._Workbook’. This operation failed because the QueryInterface call on the COM component for the interface with IID ‘{000208DA-0000-0000-C000-000000000046}’ failed due to the following error: System call failed. (Exception from HRESULT: 0x80010100 (RPC_E_SYS_CALL_FAILED)).”,

I use “Invoke VBA” inside the “ExcelApplicationScope”.

VBA code:
Sub CopyWorkbook()
Dim aw As Workbook
Dim y As Workbook
Dim sh As Worksheet

Set aw = Application.ActiveWorkbook
Set y = Application.Workbooks.Open("D:\Working.xlsx")

For i = 1 To aw.Sheets.Count
    Set sh = Nothing
    On Error Resume Next
    Set sh = y.Worksheets(aw.Worksheets(i).Name)
    On Error GoTo 0
    If TypeName(sh) <> "Nothing" Then
        sh.Range("A:BF").Copy aw.Worksheets(i).Range("A1")
    End If
Next i
Application.CutCopyMode = False

End Sub

it works if i have around 40 worksheets in a workbook, but i received this message when handling around 80 worksheets.

Hi @itmonster999

Could you check this solution here:

Hi @itmonster999, I too face a similar problem when the excel file contains large data. For smaller amount of data , its working fine. Were you able to find workaround for this issue?