Hi.
I'm new to this forum so let me introduce myself. I am a final year undergraduate in Finance and I'm teaching myself VBA programming to be ready to enter the job market.
I have a copy of "Option Pricing Models & Volatility Using Excel-VBA" and I'm going through the examples in the first chapter.
Let me show you the code:
I should probably show you one of the previous functions in the program:![]()
Function Complexop2 (rP1, iP1, rP2, iP2, operation) Dim cNum1 As cNum, cNum2 As cNum, cNum3 As cNum Dim output (2) As Double cNum1 = setcnum(rP1, iP1) cnum2 = setcnum(rP2, iP2) Select Case operation Case 1: cNum3 = cNumSub(cNum1,cNum2) ' Subtraction Case 2: cNum3 = cNumProd(cNum1,cNum2) ' Multiplication Case 3: cNum3 = cNumDiv(cNum1,cNum2) ' Division End Select output(1) = cNum3,rP output(2) = cNum3.iP complexop2 = output End Function
Now, I understand most of the code, but I still don't have a clue on the following:![]()
]Function Set_cNum (rPart, iPart) As cNum Set_cNum.rP = rPart Set_cNum.iP = iPart End Function
- Is cNum a variable type?
- What does setcnum() mean?
- What do .rP and .iP mean? What is the syntax?
- What does the line "complexop2 = output" exactly do?
I hope that somebody can help me out. Thanks in advance!
Bookmarks