![]() |
Function unable to return Collection object
Hi,
Here is a small segment of my code : " Sub SeedOPErrs() Dim a As Collection a = rFunction() ' <----VBA editor returns an error "Argument not optional" ' when I attempt to run SeedOPErrs End Sub Function rFunction() As Collection Dim a As New Collection a.Add "GT" rFunction = a End Function " What is wrong with the code above ? Why is there an error "Argument not optional" ??!! I stared at my screen for hours ...and i still cannot figure out !! Thanks in advance !!! Regards, Adrian |
Function unable to return Collection object
Sub SeedOPErrs()
Dim a As Collection Set a = rFunction For Each itm In a Debug.Print itm Next End Sub Function rFunction() As Collection Dim a As New Collection a.Add "GT" Set rFunction = a End Function -- Regards, Tom Ogilvy "Adrian" wrote in message ... Hi, Here is a small segment of my code : " Sub SeedOPErrs() Dim a As Collection a = rFunction() ' <----VBA editor returns an error "Argument not optional" ' when I attempt to run SeedOPErrs End Sub Function rFunction() As Collection Dim a As New Collection a.Add "GT" rFunction = a End Function " What is wrong with the code above ? Why is there an error "Argument not optional" ??!! I stared at my screen for hours ...and i still cannot figure out !! Thanks in advance !!! Regards, Adrian |
All times are GMT +1. The time now is 05:20 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com