View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
NickHK NickHK is offline
external usenet poster
 
Posts: 4,391
Default Class modules: parametrize class object fields

Jean-Pierre,
Your terminology is a little confusing.
In a class, you would normally talk about properties, methods, events etc.
So following the description below, something like

private m_myfld1 as string
private m_myfld2 as string
Public property Let myfld1 (vData as string)
m_myfld1=vdata
end property

Public property Get myfld1 as string
myfld1=m_myfld1
end property

If myobj.myfld1=stfld Then
...
ElseIf myobj.myfld2=stfld Then
...

Is that what you mean ?

Otherwise maybe you need to look in using a Collection "myfld" objects and
"stfld" is the key (if a string) or the index (if numeric).

NickHK

"Jean-Pierre Bidon" wrote in message
...
Hi,
My question concerns class object fields.
To be more specific, let assume I defined an object "myclass" and an
instance "myobj".
Set myobj = New myclass
Let assume too that this object has 2 fields: "myfld1" and "myfld2".
In other respects, I have a string variable {stfld} that is equal either

to
"myfld1" or to "myfld2".
Is it possible to get the value of myobj(stfld), with a syntax similar to
DAO with Access ?
I know that the previous syntax doesn't work, so my question is : does it
exist an indirect (roundabout) way to do it ?
Thanks for your help.

--
Jean-Pierre Bidon
Interstat
5 place de la République
75003 Paris
Tél: 01 45 49 19 17