//Create an ExcelApplication object
ExcelApplication xla = new ExcelApplication();
//Open a workbook containing formulas
Workbook wb = xla.Open("FormulasWorkbook.xlsx);
// Create an instance of the custom function implementation
IFunction myCustomFunction = new MyCustomFunction();
//Register the custom function
wb.RegisterCustomFunction("MyCustomFunction", myCustomFunction);
Code Block
title
VB
language
vb
'Create an ExcelApplication object
Dim xla As New ExcelApplication
'Open a workbook containing formulas
Dim wb As Workbook = xla.Open("formulasWorkbook.xlsx")
'Create an instance of the custom function implementation
Dim myCustomFunction As IFunction = new MyCustomFunction()
'Register the custom function
wb.RegisterCustomFunction("MyCustomFunction", myCustomFunction)
Exceptions
Exception
0
SAException
If the custom function has already been registered with the workbook.