LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Using Property Let with a Type as member of a Class

I've encountered a need to build a Class module that has a couple of
Types as members. So first the Type is defined in a standard module,
thus:

Public Type FitParms
XVar as String
YVar as String
Formula as String
Par(6) as Double
End Type

Then, in a Class module called PcGroup there are these statements:

Private jprms as FitParms
Public Property Get JParms() As FitParms
JParms = jprms
End Property
Public Property Let JParms(RHS As FitParms)
jprms = RHS
End Property

Now here's the "problem": the Let doesn't work the way I would like it
to. If gp is an instance of the PcGroup class, the Get works just as
expected: the statement

Private JFormula as String
JFormula = gp.JParms.Formula

assigns the appropriate value from the jprms Type to the local
variable JFormula. But if I try to do it the other way:

gp.JParms.Formula = JFormula

this again invokes the Property Get module, not the Let, and nothing
is assigned to the Formula field in jprms. The only way I can use the
Let is by defining a local FitParm variable and then assigning the
whole thing, like this:

Private fp as FitParm
fp = gp.JParms
fp.Formula = JFormula
gp.JParms = fp

Then the Let module is invoked and the assignment is made.

Am I missing something here? Is this really the way this works, or is
there some way make the Let to work the way I want it to? VBA doesn't
allow me to declare the Type as a Public member of the Class, so I
can't bypass the Get/Let construction.

Thanks,
Ken Dahlberg
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to set the FormulaArrary property of the range class RTK Excel Worksheet Functions 0 April 13th 10 08:38 AM
unable to get the pivotfields property of the pivottable class dhstein Excel Discussion (Misc queries) 0 January 6th 10 02:27 AM
unable to set the values property of the series class BHatMJ Excel Discussion (Misc queries) 4 July 10th 09 03:46 PM
How to cycle through each of property and its value of Class? Tetsuya Oguma Excel Worksheet Functions 1 March 3rd 06 10:36 AM
Is it possible to set a class member to be another class member? Michael[_21_] Excel Programming 3 October 30th 03 08:28 AM


All times are GMT +1. The time now is 01:41 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"