External access to Excel is messy and requires constant updates.
My experience too.
I have much better experience using FPSpreadSheet (
https://wiki.freepascal.org/FPSpreadsheet).
If OP still insist using VBA code from Lazarus the way he described, this might be the way:
1. Call dll as shown in post #12 (with regards of using correct types as explained in #23)
2. Running VBA code from dll as shown in post #11
3. Changing Excel's cells as shown in post #34
As we don't know the details of OP's intentions (is this one time convert, does he want to make universal tool to do this, what does VBA code do) this could be very complex task. Depending of what VBA code do, might mean that VBA code can't be run at all as shown in post #11. If it is one time convert, it might be easier to convert VBA code to Pascal and skip step 2.