I've tried to execute VBA excel macro named "mainCOC" and excel file name COC.xlsm. my VS Studio 2012 and MS Office 2013, .NET Version 4.5 Here is my simple function to open and run macro.
Try
appExcel = Microsoft.VisualBasic.Interaction.CreateObject("Excel.Application")
appExcel.Workbooks.Open(filename:="E:DOTNET_COFC\COC.xlsm", ReadOnly:=True, Notify:=True)
appExcel.Run("mainCOC")
MsgBox("Successfully run macro")
Catch ex As Exception
MsgBox(ex.ToString)
Finally
appExcel.Workbooks.Close()
End Try
Unfortunately i catch an error : System.Runtime.InteropeService.COMException (0x80010105): The server threw an exception. (Excepting from HRESULT: 0X80010105 (RPC_E_SERVERFAULT)) .......
ANYONE CAN FIGURE OUT WHAT HAPPEN?
User contributions licensed under CC BY-SA 3.0