Hello Ioannis,
I think there are a few issues with that code. In particular its not clear to me why you would be running a script to set an expression within a loop and repeatedly running LEAP. Could you tell us more about what you are trying to do and what the i variable is intended to represent?
But to answer your very particular question, the reason the code would fail at this line...
LEAP.Branch("Transformation\Electricity Generation\Processes\Lignite").Variable("Capital Cost").Expression = "Interp(2030;2075*i;"2040;2075*2*i)"
...is because you have written the right-hand-side (RHS) of the equation (the Interp expression) as a simple string. Notice that the whole of the RHS is enclosed in quotes, so VBscript will interpret that literally. It does not know that you are intending to use the i as a variable! You could write the RHS instead like this..
="Interp(2030;2075*" & i & ";"2040;2075*2*" & i & ")"
When you do that, VBScript will construct an expression out of the quoted text along with the interpreted value of the i variable.
I hope this helps!
Best,
Charlie