Leandroarb
Board Regular
- Joined
- Oct 7, 2014
- Messages
- 157
Hi guys!
I share this file here, it's a simple way to make a calendar.
Download: https://drive.google.com/file/d/1BEDJLLdUajUiqh7rwwW3iUCDg1FJjOjA/view?usp=drivesdk
I use simple functions and creativity.
The loop does the opposite way of what I believe would be conventional.
When dealing with dates assembled with the year in the combobox and day and month in the listbox, the code uses the 'Me ()' operator to find the field with equal name.
Example:
The month can have up to six weeks, so for each week I have created seven fields that are the days named this way (in Portuguese):
DomSem1, SegSem1, TerSem1, QuaSem1, QuiSem1, SexSem1, SabSem1.
In English it would be:
SunWeek1, MonWeek1, TueWeek1, Wedweek1, ThuWeek1, FriWeek1, SatWeek1.
These fields are labels.
And so on to the other weeks of the month.
I use abbreviations for names not to have fields with very long names.
The functions in the loop do the following:
Sets the size of the loop according to the number of days in the month.
And
Assemble the names of the labels where the days of the month will be painted. If it were today: 01/24/2018 in Portuguese it would be 'QuaSem4', in English 'WedWeek4'.
I hope it's useful.
Regards!
I share this file here, it's a simple way to make a calendar.
Download: https://drive.google.com/file/d/1BEDJLLdUajUiqh7rwwW3iUCDg1FJjOjA/view?usp=drivesdk
I use simple functions and creativity.
The loop does the opposite way of what I believe would be conventional.
When dealing with dates assembled with the year in the combobox and day and month in the listbox, the code uses the 'Me ()' operator to find the field with equal name.
Example:
The month can have up to six weeks, so for each week I have created seven fields that are the days named this way (in Portuguese):
DomSem1, SegSem1, TerSem1, QuaSem1, QuiSem1, SexSem1, SabSem1.
In English it would be:
SunWeek1, MonWeek1, TueWeek1, Wedweek1, ThuWeek1, FriWeek1, SatWeek1.
These fields are labels.
And so on to the other weeks of the month.
I use abbreviations for names not to have fields with very long names.
The functions in the loop do the following:
Code:
Day (DateSerial (Year (dtDiaPri), Month (dtDiaPri) + 1, 0)) - 1
Code:
Me (Format (dtDiaPri + j, "ddd") & "Sem"
Code:
DatePart ("ww", dtDiaPri + j) - DatePart ("ww", DateSerial (Year (dtDiaPri + j), Month (dtDiaPri + j), 1)) + 1) .Caption = Format d ")
I hope it's useful.
Regards!