Create excel addins in Lazarus lazarus / 21-General ---------------------------------------------------------------------- Packs · 2023-10-07 23:42 Can we create excel addins in Lazarus ---------------------------------------------------------------------- dseligo · 2023-10-08 00:10 We can. Look at example: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i library excel_dll; {$mode objfpc}{$H+} uses  Classes; function calc_get: Integer; stdcall;begin  Result := 78;end; function calc_int(ainput: Integer): Integer; stdcall;begin  Result := ainput * ainput + 1;end; function calc_double(ainput: Double): Double; stdcall;begin  Result := ainput * ainput + 1;end; exports calc_get;exports calc_int;exports calc_double; begin end. And those are my notes that goes with this example: Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i In Excel and LibreOffice it should look like this:Private Declare PtrSafe Function calc_get Lib "C:\temp\excel_dll\excel_dll.dll" () As IntegerPrivate Declare PtrSafe Function calc_int Lib "C:\temp\excel_dll\excel_dll.dll" (ByVal a As Integer) As IntegerPrivate Declare PtrSafe Function calc_double Lib "C:\temp\excel_dll\excel_dll.dll" (ByVal a As Double) As Double Sub Test()  my_num = calc_get  MsgBox (my_num)   my_num = calc_int(10)  MsgBox (my_num)   my_num = calc_double(1.5)  MsgBox (my_num)End Sub Remark: in LibreOffice I don't need 'Private' in front of 'Declare'Remark: I have to be careful if I compile to 32 or 64 bits - depends on installation of Office/Libre OfficeRemark: in Excel I have to put full path to dll, otherwise it doesn't work after saving/reopeningRemark: I have to declare strings as WideString If I want to use as UDF, then insert new module and put in it:Private Declare PtrSafe Function calc_get Lib "C:\temp\excel_dll\excel_dll.dll" () As IntegerPrivate Declare PtrSafe Function calc_int Lib "C:\temp\excel_dll\excel_dll.dll" (ByVal a As Integer) As IntegerPrivate Declare PtrSafe Function calc_double Lib "C:\temp\excel_dll\excel_dll.dll" (ByVal a As Double) As Double Function cell_get() As Integer  cell_get = calc_getEnd Function Function cell_int(a As Integer) As Integer  cell_int = calc_int(a)End Function Function cell_double(a As Double) As Double  cell_double = calc_double(a)End Function I use it like this in cells:= cell_get()=cell_int(A4)=cell_double(A5) https://docs.microsoft.com/en- us/office/vba/language/reference/user-interface-help/declare- statementhttps://docs.microsoft.com/en-us/office/client- developer/excel/how-to-access-dlls-in-excelhttps://help.libreoffice.or g/latest/he/text/scalc/01/04060112.html Hope this helps. ---------------------------------------------------------------------- Packs · 2023-10-08 06:10 Thanks so much. I will try this. I have to create dll and use inside vba code. ---------------------------------------------------------------------- Packs · 2023-10-08 07:24 I can expose my function and use inside vba code. How to create own ribbon,form and cell rendering ---------------------------------------------------------------------- Packs · 2023-10-08 16:11 I have tried the code . it is not working in excel. I am sharing the code . Please tell me what will be the error in my code ---------------------------------------------------------------------- dseligo · 2023-10-14 09:06 Quote from: Prakash on October 08, 2023, 06:11:06 pmI have tried the code . it is not working in excel. I am sharing the code . Please tell me what will be the error in my code I've been very busy and missed this post, sorry. I can't see anything wrong with code or 'Book1.xlsm' Excel file. I recreated path you were using (D:\RD\lazarus\excel_dll), put files there and it worked (see screenshot). 1st: check if bitness of dll you create is same as Excel's, it will work only they match. 2nd: check you really have dll by name excel_dll.dll in directory D:\RD\lazarus\excel_dll. ---------------------------------------------------------------------- Packs · 2023-10-17 05:45 Thanks. It is not working for  me . all dll functions are got exposed inside excel but it is not executing . I am really not getting why it is not working for me . ---------------------------------------------------------------------- Packs · 2023-10-17 05:47 Private Declare PtrSafe Function calc_get Lib "D:\RD\lazarus\excel_dll\excel_dll.dll" () As Integer Private Declare PtrSafe Function calc_int Lib "D:\RD\lazarus\excel_dll\excel_dll.dll" (ByVal a As Integer) As Integer Private Declare PtrSafe Function calc_double Lib "D:\RD\lazarus\excel_dll\excel_dll.dll" (ByVal a As Double) As Double Function cell_get() As Integer   cell_get = calc_get End Function Function cell_int(a As Integer) As Integer   cell_int = calc_int(a) End Function Function cell_double(a As Double) As Double   cell_double = calc_double(a) End Function I have share the module code too ---------------------------------------------------------------------- Packs · 2023-10-28 02:32 How to pass excel multiple row or column as a parameter to dll