Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Jun 2004
    Location
    Gtr London, England
    Posts
    90
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Passing a Collection (Office 2003)

    Morning (or Afternoon depending on where you are in the world !)

    Can anyone help?

    I am having problems with passing a collection. I have a function which I am calling "PopulateProfileType(pstrName As String) As Collection". I have set a New Collection from the code that calls the function, the code reads "Set colProfileCollection = PopulateProfileType("Name")" .

    I am trying to pass back the collection and have (after the collection has been created) put a line of code in "PopulateProfileType = colProfileCollection". I'm not sure what is wrong but I can't seem to pass this collection back. I keep getting an error "Argument not optional". I haven't seemed to have a problem with passing functions before but in this case it's all going wrong !!!

    Any ideas?

    Many thanks
    Jack

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Passing a Collection (Office 2003)

    I think you'll have to tell us what you want to accomplish, and a bit more of the code you have. What you posted seems circular:
    Set colProfileCollection = PopulateProfileType("Name")
    and
    PopulateProfileType = colProfileCollection

  3. #3
    Star Lounger
    Join Date
    Jun 2004
    Location
    Gtr London, England
    Posts
    90
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Passing a Collection (Office 2003)

    After taking a closer look I realised I had not "Set" the PopulateProfileType = colProfileCollection, when I had done this it carried across. Have since found out that this isn't the best way forward for the type of function I want to run - so it's back to the drawing board.

    Thanks for your help though.
    Regards
    Jack

Posting Permissions

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