S
Stephen Lloyd
I'm creating a macro that I want to be more object oriented than procedural.
The macro sends out schedules to employees. The user interacts with a
userform to select the groups to which the schedules should go.
I started by declaring the userform directly from my main sub in the
following fashion.
Dim frmUserForm As FUserformm
Set frmUserForm = New FUserForm
Later, since I wanted to use a class module to encapsulate the information
and functionality I thought I should instead declare the userform in the
class module in a similar fashion as above in order to read values from the
userform into properties in the class module.
i.e. I want to access objSchedules.daynum from the main module where daynum
is determined by a date selected on the userform.
1. Should I declare the userform object in the class module or the main
module?
2. If in the class module, do I also need to declare the class in the
userform module to access properties in the class module? How?
3. If in the main module do I simply set the obj properties using form
properties, i.e.
objSchedules.daynum = frmUserFrom.DayofWeek where DayofWeek has it's own
set of Get and Let procedures and the Let is called from the userforms
OK_Click.
I might have a good cry after this. Thanks for any and all help. I have
read extensively on chip pearsons web site and an article on peltier's
website as well as research on ozgrid and MrExcel. Nothing seems to discuss
interaction between custom class modules and userform(class) modules.
The macro sends out schedules to employees. The user interacts with a
userform to select the groups to which the schedules should go.
I started by declaring the userform directly from my main sub in the
following fashion.
Dim frmUserForm As FUserformm
Set frmUserForm = New FUserForm
Later, since I wanted to use a class module to encapsulate the information
and functionality I thought I should instead declare the userform in the
class module in a similar fashion as above in order to read values from the
userform into properties in the class module.
i.e. I want to access objSchedules.daynum from the main module where daynum
is determined by a date selected on the userform.
1. Should I declare the userform object in the class module or the main
module?
2. If in the class module, do I also need to declare the class in the
userform module to access properties in the class module? How?
3. If in the main module do I simply set the obj properties using form
properties, i.e.
objSchedules.daynum = frmUserFrom.DayofWeek where DayofWeek has it's own
set of Get and Let procedures and the Let is called from the userforms
OK_Click.
I might have a good cry after this. Thanks for any and all help. I have
read extensively on chip pearsons web site and an article on peltier's
website as well as research on ozgrid and MrExcel. Nothing seems to discuss
interaction between custom class modules and userform(class) modules.