If Application.International(xlDateOrder) = 0 Then ' 0 = month-day-year 1 = day-month-year 2 = year-month-day This Sub will be called in the UserForm Initialize Event procedure. This is the main procedure for creating the calendar for the Date Picker.Next, create a Private Sub called Create_Calender.These variables will be available in every Sub Procedure. Firstly, declare the variables you will be using in the full process under Option Explicit.In this step, you have to insert VBA codes into the UserForm. This is the most important step in creating a date picker. Keep your UserForm simple and easy to read.I have changed the background color of the Calendar Frame.Here, I have changed the Caption of the Farme1 to “Date Picker”.You can change the background color, text alignment, caption, font, etc. This step is just to make the UserForm look better. In this step, I will change the properties of the UserForm according to my choice. Step 03: Change Properties of the Date Picker UserForm Finally, the design of the UserForm is complete.Change the Captions, Font, and Alignment of Text according to the image below.Therefore, the UserForm will look like the image below.Change the Font, Font style, and Size to Calibri, Bold, and 12.Edit the Caption of the CheckBox as “Add Time”.Insert a CheckBox Control below the Calendar Frame.Change the Name of each CommandButton as C2, C3, C4, …….C42.As a result, a calendar-like interface has been created.Later, paste this set of CommandButtons for 5 more times.Next, select the 7 CommandButtons at a time and Copy this whole group.Then, copy the CommandButton 6 more times and paste them serially.Later, with the help of the VBA code the Caption will be added. Set the Name Option of the CommandButton as “C1” from the Properties Window.Next, add CommandButton Control inside the Calendar Frame.Set the Caption of the other 6 Labels as the Weekday’s short forms.Change the Caption of the first Label to “Sun” from the Properties Window.Follow the Image for a better understanding.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |