Re: Newbie: How to extract year from a Date object

Tech-Archive recommends: Speed Up your PC by fixing your registry



you can use year,month,day in an enum
if you use the full syntax for the vba functions
example:
Private Enum enumDates
Year
Month
Day
End Enum

Private Sub Command1_Click()
Print VBA.Year(Now), VBA.Month(Now), VBA.Day(Now)
Print Year, Month, Day
End Sub

"Someone" <nobody@xxxxxxx> wrote in message
news:eMXXe.44114$ct5.9164@xxxxxxxxxxxxx
> I just found out that if you use "Year" as an item in Enum, it will not
> work. It would give you a compile time error.
>
> Example:
>
> Private Enum enumDates
> Year
> Month
> Day
> End Enum
>
> This will override Year(), Month(), and Day() functions since they are
part
> of VBA library, which is part of VB6.
>
> To avoid these problems, I always prefix Enum elements with "enm" or
"enum".
> Most likely I would write it like this:
>
> Private Enum enumDates
> enmDateYear
> enmDateMonth
> enmDateDay
> End Enum
>


.