Results 1 to 10 of 10

Learning VBA: Need Some Explanations on Language

Threaded View

  1. #1
    Registered User
    Join Date
    04-08-2010
    Location
    Montreal
    MS-Off Ver
    2003 & 2010
    Posts
    16

    Learning VBA: Need Some Explanations on Language

    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:
    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
    I should probably show you one of the previous functions in the program:
    ]Function Set_cNum (rPart, iPart) As cNum
    Set_cNum.rP = rPart
    Set_cNum.iP = iPart
    End Function
    Now, I understand most of the code, but I still don't have a clue on the following:
    1. Is cNum a variable type?
    2. What does setcnum() mean?
    3. What do .rP and .iP mean? What is the syntax?
    4. What does the line "complexop2 = output" exactly do?

    I hope that somebody can help me out. Thanks in advance!
    Last edited by royUK; 04-08-2010 at 02:18 PM. Reason: Added Code Tags

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1