Call Excel VBA file from C# 0x80010105 error

0

I been trying to call a VBA function from c# to automate some process, the problem is that when the Excel.Application visibility is false I get this error:

The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT))

When the visibility is true everything works perfectly but the it opens the excel application and I need to keep this process in the background not in the foreground, any idea?

Thanks!

Just works when visible is true, if not I get: "The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT)" )

Function DetermineStructureUpdates(DataDBPathAndName As String, DataCopyDBPathAndName As String, SyncDBPathAndName As String, DataDBPw As String, SyncDBPw As String) As String
dbDataPathAndName = DataDBPathAndName
dbDataCopyPathAndName = DataCopyDBPathAndName
dbSyncPathAndName = SyncDBPathAndName
dbDataPW = DataDBPw
dbSyncPW = SyncDBPw
AppActivate Application.Caption 'Bring Excel to the foreground
On Error GoTo ErrorHandling
Call DetermineDBStructure
If ErrorMessage <> "" Then GoTo ErrorHandling
DetermineStructureUpdates = "Success"
Exit Function

ErrorHandling: DetermineStructureUpdates = ErrorToReturn End Function

c#
excel
vba
asked on Stack Overflow Sep 20, 2017 by Byron Josue Serrano Nuñez • edited Jul 9, 2018 by Community

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0