•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Perl section within the Software Development category of DaniWeb, a massive community of 425,774 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,334 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Perl advertiser: Programming Forums
Views: 392 | Replies: 0
![]() |
•
•
Join Date: Jun 2008
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
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
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
![]() |
•
•
•
•
•
•
•
•
DaniWeb Perl Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
access activation api blogger blogging blogs code code injection combo dani daniweb data debugging development dreamweaver dropdownlist epilepsy gdata google gpl griefers hackers html innovation javascript key linux microsoft module net news openbsd product programming reuse rss serial source tags vista web wysiwyg xml
- ambiguous part 3 (C)
- code tags (DaniWeb Community Feedback)
- Code Caving (C)
- help with ASP and/or HTA code (ASP)
- Virgin programmer (Java)
- DrawHouse Code Problem (Java)
- Key Press event Restriction (Java)
- Great problem in VC++ (C++)
Other Threads in the Perl Forum
- Previous Thread: Perl in real life
- Next Thread: parsing a webpage


Linear Mode