User Name Password Register
DaniWeb IT Discussion Community
All
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
Reply
Join Date: Jun 2008
Posts: 1
Reputation: neverland is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
neverland neverland is offline Offline
Newbie Poster

Help with code, sorry for my ignorance

  #1  
Jun 6th, 2008
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
AddThis Social Bookmark Button
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Perl Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Perl Forum

All times are GMT -4. The time now is 2:49 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC