Results 1 to 5 of 5

String array values to array of User-Defined Types

Threaded View

rtiltins String array values to array... 10-02-2008, 03:51 PM
shg Welcome to the forum. What... 10-02-2008, 04:02 PM
rtiltins outer is an integer variable... 10-02-2008, 04:18 PM
Andy Pope The important thing is the... 10-02-2008, 05:51 PM
rtiltins Yep, that does work. Thanks a... 10-03-2008, 07:45 AM
  1. #1
    Registered User
    Join Date
    10-02-2008
    Location
    Canada
    Posts
    8

    String array values to array of User-Defined Types

    Hi all,

    I have a class module with several private variables, including one that is an array of a user-defined type. I am trying to set the values of a single element of this array with "Property Let ..." from a string array:

    Public Property Let EnterMFSwap(ByVal index As Integer, ByRef values() As String)
        MFSwaps_(index).Name = values(0)
        MFSwaps_(index).Units = values(1)
        MFSwaps_(index).Notional = values(2)
        MFSwaps_(index).Fee = values(3)
        MFSwaps_(index).Daycount = values(4)
        MFSwaps_(index).PFP = values(5)
        MFSwaps_(index).PFR = values(6)
        MFSwaps_(index).TradeDate = values(7)
        MFSwaps_(index).EffectiveDate = values(8)
        MFSwaps_(index).Maturity = values(9)
        MFSwaps_(index).Leg1 = values(10)
        MFSwaps_(index).Leg2 = values(11)
        MFSwaps_(index).Holidays = values(12)
        MFSwaps_(index).SettleRule = values(13)
        MFSwaps_(index).Underlying = values(14)
    End Property
    In my test code, I set all of the string array variables, and try to set it using:
    temporary.EnterMFSwap(outer) = tempString
    And get the following error message:
    "Compile error: Can't assign to array"

    Is there a way to set the values in the user-defined type this way? I could do it by creating a temporary variable of the User-defined type and then there is no problem, but this is used by a lot of very old code as well that gives the needed values as an array.

    Thanks in advance
    Last edited by rtiltins; 10-03-2008 at 07:46 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Multi Criteria combo box returning array values
    By robcosta in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-24-2008, 10:41 AM
  2. unable to set y values with an array
    By tamushrek in forum Excel Charting & Pivots
    Replies: 10
    Last Post: 08-11-2008, 11:58 AM
  3. Copy Range to array Rounds Values?
    By additude in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-01-2008, 08:49 AM
  4. Copy values from Excel Range to VBA array.
    By Bjornar in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-29-2007, 05:32 PM
  5. web service call from user defined function
    By parm in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-17-2007, 12:03 AM

Tags for this Thread

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