I have a certain VBA file in which I want to change 2 things automatically (this file is automatically generated and I don't want to change it manually over and over again)
Suppose the name of this file is
BAS_IN.bas
and the contents are:
Function AsianOption(Optional SpotVector As Variant, _
Optional Fixings As Variant, _
Optional InterestVector As Variant, _
Optional DividendVector As Variant, _
Optional Interest As Variant, _
Optional ParameterMatrix As Variant, _
Optional Strike As Variant, _
Optional ObservationTimes As Variant, _
Optional Product As Variant, Optional Model As Variant, _
Optional Greeks As Variant, Optional NSims As Variant, _
Optional continuous As Variant, _
Optional Nobs As Variant) As Variant
Dim Price, GreekValues As Variant
On Error Goto Handle_Error
Call InitModule
If ProductLibclass Is Nothing Then
Set ProductLibclass = CreateObject( "ProductLib.ProductLibclass.1_0")
End If
Call ProductLibclass.AsianOption( _
1, Price, GreekValues, SpotVector, Fixings, InterestVector, _
DividendVector, Interest, ParameterMatrix, Strike, _
ObservationTimes, Product, Model, Greeks, NSims, continuous, Nobs)
AsianOption = Price
Exit Function
Handle_Error:
AsianOption = "Error in " & Err.Source & ": " & Err.Description
End Function
I want to replace ".1_0" by nothing (so delete it)
and then, I want to get rid of those line continuations _ to some extent at least
In this automatically generated file, there are too many of those VBA line continuations. But I suppose there is a limit to how many characters you can have in one line, so I would like to remove them, under the constraint that the line does not get longer than xxx characters.
The output should go to
OUT_BAS.bas
From my memory, I know that this is really easy to do in Perl, but I can't do it anymore
I would be really happy