LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 244
Default Object instead of passing arguments

Hi! I have a sub that calls another sub and passes alot of arguments. The
idea is for the main sub to send Strings to the other sub that fills those
strings with data. This works fine but is it possible to use an obect instead
and just pass the object as argument? How would you write that? The problem
is that the number of arguments may become very large and it just seems like
a bad idea to pass eg 20 arguments to a sub? Any help appreciated!

Here is the main sub:
Dim secID As String
Dim strikePrice As String
Dim maturityDate As String
Dim counterParty As String
Dim numberOfUnits As String
Dim optionType As String
Dim excerciseType As String

If sSecurityTypeText = "#FX OPTION" Then
oPosFile.Cells(i, 1).Value = "COMMODITY OPTION"
secID = oPosFile.Cells(i, 3)
Call readFXOptionFile(secID, numberOfUnits,
strikePrice, maturityDate, counterParty, optionType, excerciseType)

and here is the other sub:

Public Sub readFXOptionFile(ID As String, unts As String, strike As String,
matDate As String, cPrt As String, tpe As String, exType As String)
Dim i As Long

ID = Split(ID, "_")(0)
Workbooks.Open "X:\SCD_RiskManager_Pos\RMDBII\test.xls"
Workbooks("test.xls").Activate

Range("A1").Activate
Do Until ActiveCell.Offset(i, 0) = ""
If InStr(CStr(ActiveCell.Offset(i, 0)), ID) 0 Then 'match ID
unts = ActiveCell.Offset(i, 1) 'assign
data
strike = ActiveCell.Offset(i, 3)
matDate = ActiveCell.Offset(i, 4)
cPrt = ActiveCell.Offset(i, 5) 'fix cells!!!!!!!
tpe = ActiveCell.Offset(i, 5)
exType = ActiveCell.Offset(i, 5)
End If
i = i + 1
Loop
End Sub


Any help most appreciated! Thanks alot!

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing Arguments in Excell UB Excel Worksheet Functions 3 February 13th 07 04:08 PM
Passing arguments from VBA to DLL [email protected] Excel Programming 10 August 18th 06 09:08 AM
Passing arguments to userforms Steve Excel Programming 2 June 13th 06 05:31 PM
passing arguments to events Paul Excel Programming 2 May 24th 06 03:18 PM
Passing Arguments Grant Reid Excel Programming 8 May 24th 04 01:39 PM


All times are GMT +1. The time now is 05:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"