Thanks for your input, but that not exactly what i'm looking for. I'm sorry,
i guess i wan't clear enough. I'm working on a Gantt style calendar to
display a schedule one month at a time. I have everything working but the
last thing I want to do is to make they days of the month dynamic based on
the number of days in the month. The labels for the days of the month width
vaires based upon how many days since the entire width of all the days is a
fixed width. Below is a copy and paste of the code that i have written that
works, but is cumbersome to write and i was wondering if i could use a loop
instead:
Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As
Integer)
Dim lngNumDays As Long
Dim lngDayLength As Long
lngNumDays = Day(DateSerial(Year(Date), Month(Date) + 1, 0))
lngDayLength = Me.boxTimeLine2.Width / lngNumDays
Me.Date1.Height = Me.boxTimeLine2.Height
Me.Date1.Width = lngDayLength
Me.Date1.Top = Me.boxTimeLine2.Top
Me.Date1.Left = Me.boxTimeLine2.Left
Me.Date1.BorderStyle = 1
Me.Date1.TextAlign = 2
Me.Date2.Height = Me.boxTimeLine2.Height
Me.Date2.Width = lngDayLength
Me.Date2.Top = Me.boxTimeLine2.Top
Me.Date2.Left = Me.boxTimeLine2.Left + Me.Date1.Width
Me.Date2.BorderStyle = 1
Me.Date2.TextAlign = 2
Me.Date3.Height = Me.boxTimeLine2.Height
Me.Date3.Width = lngDayLength
Me.Date3.Top = Me.boxTimeLine2.Top
Me.Date3.Left = Me.boxTimeLine2.Left + Me.Date1.Width + Me.Date2.Width
Me.Date3.BorderStyle = 1
Me.Date3.TextAlign = 2
lngNumdays is the number of days for the current month.
lngDayLength is the size of each day label based upon the number of days.
Each label is inside of a invisable box called Me.boxTimeline2 which is why
all of the sizes of the labes is based upon that box.
As you can see, i have the exact same settings for each label except for the
Left which is based upon all of the previous lables sizes.