Calling an excel function
-
Hi, I have an addin module plugged into Excel, which exposes some functions to do stuff. Im need to call those function through some VB.Net code, but its failing without much help. Its a generic ole error returned, nothing useful at all. If the workbook contains a function/macro, I can call that easy using the
Excel.ExecuteExcel4Macro()
line. But this doesnt seem to work for addins. My code looks like this:Dim ex As New Microsoft.Office.Interop.Excel.Application() ... Do stuff ... ex.ExecuteExcel4Macro("RUN(""ConvertData"")") ex.Visible = True
The VB.Net program opens Excel as a COM object, post some data to it, then needs to call the functions in the addin. Anyone know of the correct syntax, or can spot where Ive gone wrong? Mark -
Hi, I have an addin module plugged into Excel, which exposes some functions to do stuff. Im need to call those function through some VB.Net code, but its failing without much help. Its a generic ole error returned, nothing useful at all. If the workbook contains a function/macro, I can call that easy using the
Excel.ExecuteExcel4Macro()
line. But this doesnt seem to work for addins. My code looks like this:Dim ex As New Microsoft.Office.Interop.Excel.Application() ... Do stuff ... ex.ExecuteExcel4Macro("RUN(""ConvertData"")") ex.Visible = True
The VB.Net program opens Excel as a COM object, post some data to it, then needs to call the functions in the addin. Anyone know of the correct syntax, or can spot where Ive gone wrong? MarkMark, Try this: http://support.microsoft.com/kb/198571[^] The article is for Access 2000, but the code would be very similar. (Without the Set statements of course.)
objExcel.Application.Run("atpvbaen.xla!lcm", 5, 2)
Dave