Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Example
Code Block
titleC#
languagec#
//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
titleVB
languagevb
'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
0SAException

If the custom function has already been registered with the workbook.

...