ClimoC
Well-known Member
- Joined
- Aug 21, 2009
- Messages
- 584
Guten Tag
As a work around to the loss of the Calendar-Control in 2010, I've sourced (googled) a class 'Calendar' with a nifty wee Userform (anyone who can help with this will be aware of such things)
So I have several non-modal userforms in my App, some of them have date-fields that require manual entry typing of dd/mm/yy etc (No single userform has more than one date-box in it, this I think may be pivotally helpful)
Now the Userform 'Calendar' that is built on the class of the same (cCalendar) name, has the write value line 'ActiveCell.value = theCal.value'
I'm looking to change this to refer to the correct userform.Textbox value, depending on which form is open.
I would imagine I could simply have a global string, whose value is set (or re-set) whenever a Userform is initialized (some sort of 'ActiveUF.value = Me.Name), where I get lost is referring to the components by name, so as to have a case statement by where I go:
Can anyone suggest a better way of doing this (instead of passing around the userform name as a variable) - or advise the proper syntax for referring to controls outside of the 'active' userform (but an open userform nonetheless) please?
Every time I have to do this particular thing with userforms, I completely forget how, and the object browser always leads me on an infinite loop of
Application.vbe.activevbproject.vbcomponents.vbe.active....
Thanks
C
PS - there may be one slight complication to the process - one of the forms, has a 2-tab page in it, each page having similar (but named differently) fields. So I may need to be able to throw in 'Activepage' or whatnot
As a work around to the loss of the Calendar-Control in 2010, I've sourced (googled) a class 'Calendar' with a nifty wee Userform (anyone who can help with this will be aware of such things)
So I have several non-modal userforms in my App, some of them have date-fields that require manual entry typing of dd/mm/yy etc (No single userform has more than one date-box in it, this I think may be pivotally helpful)
Now the Userform 'Calendar' that is built on the class of the same (cCalendar) name, has the write value line 'ActiveCell.value = theCal.value'
I'm looking to change this to refer to the correct userform.Textbox value, depending on which form is open.
I would imagine I could simply have a global string, whose value is set (or re-set) whenever a Userform is initialized (some sort of 'ActiveUF.value = Me.Name), where I get lost is referring to the components by name, so as to have a case statement by where I go:
Code:
Private Sub theCal_AfterUpdate()
Select Case ActiveUF
Case "AddForm"
application.vbe.components("AddForm").controls("AddFormDatePicker").value = theCal.value
Case "EditForm"
'.... etc
end select
end sub
Can anyone suggest a better way of doing this (instead of passing around the userform name as a variable) - or advise the proper syntax for referring to controls outside of the 'active' userform (but an open userform nonetheless) please?
Every time I have to do this particular thing with userforms, I completely forget how, and the object browser always leads me on an infinite loop of
Application.vbe.activevbproject.vbcomponents.vbe.active....
Thanks
C
PS - there may be one slight complication to the process - one of the forms, has a 2-tab page in it, each page having similar (but named differently) fields. So I may need to be able to throw in 'Activepage' or whatnot