+ Reply to Thread
Results 1 to 5 of 5

String array values to array of User-Defined Types

  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:

    Please Login or Register  to view this content.
    In my test code, I set all of the string array variables, and try to set it using:
    Please Login or Register  to view this content.
    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.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    Welcome to the forum.

    What is outer? The property Let requires an index and an array as arguments.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    10-02-2008
    Location
    Canada
    Posts
    8
    outer is an integer variable that is used as a counter in a for loop. That line is inside the for loop. I tried other variable types, such as Long in that place, but always got the same message.

    Thanks

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481
    The important thing is the declaration of the tempstring array.

    This cut down version works

    class module
    Please Login or Register  to view this content.
    Code module
    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  5. #5
    Registered User
    Join Date
    10-02-2008
    Location
    Canada
    Posts
    8
    Yep, that does work. Thanks a lot!

+ Reply to Thread

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