ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Active X CAlender day colour (https://www.excelbanter.com/excel-programming/408149-active-x-calender-day-colour.html)

joel

Active X CAlender day colour
 
Dear All,

This maybe a very simple question but I have created a calender in excel
using active X I was wondering how I would go about colouring in for example
every Wednesday of that month so they stand out I have looked in all the
properties and I haven't found a way

Kind regards Joel
--
N/A

Leith Ross[_2_]

Active X CAlender day colour
 
On Mar 21, 4:08 pm, Joel wrote:
Dear All,

This maybe a very simple question but I have created a calender in excel
using active X I was wondering how I would go about colouring in for example
every Wednesday of that month so they stand out I have looked in all the
properties and I haven't found a way

Kind regards Joel
--
N/A


Hello Joel,

If you are referring to a MonthView control, you can bold the days you
want. Since this control has a window handle, it might be possible to
use the API to color the selected dates, but I not sure it would be
worth the effort to make the dates stand out.

Here are the code routines to bold the Wednesdays month by month. The
MonthView is on a UserForm.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Sub BoldWednesdays()

Dim D As Variant
Dim FirstDay As Long
Dim LastDay As Long
Dim M As Long, y As Long

With MonthView1
y = .Year
M = .Month
End With

FirstDay = DateSerial(y, M, 1)
LastDay = DateSerial(y, M + 1, 1) - 1

DoEvents

For D = FirstDay To LastDay
If Weekday(D, vbSunday) = 4 Then
MonthView1.DayBold(D) = True
End If
Next D

End Sub

Private Sub MonthView1_MouseMove(ByVal Button As Integer, ByVal Shift
As Integer, ByVal x As stdole.OLE_XPOS_PIXELS, ByVal y As
stdole.OLE_YPOS_PIXELS)

Dim Ret

Ret = MonthView1.HitTest(x, y, MonthView1.Value)
Select Case Ret
Case Is = 8, 9
BoldWednesdays
End Select

End Sub

Private Sub UserForm_Activate()

BoldWednesdays

End Sub
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Sincerely,
Leith Ross

joel

Active X CAlender day colour
 
Hi thanks for the code, I have tried and can't seem to get it work. I am
double clicking the calender and pasting the code in to there. Please can you
help

Thanks Joel
--
N/A


"Leith Ross" wrote:

On Mar 21, 4:08 pm, Joel wrote:
Dear All,

This maybe a very simple question but I have created a calender in excel
using active X I was wondering how I would go about colouring in for example
every Wednesday of that month so they stand out I have looked in all the
properties and I haven't found a way

Kind regards Joel
--
N/A


Hello Joel,

If you are referring to a MonthView control, you can bold the days you
want. Since this control has a window handle, it might be possible to
use the API to color the selected dates, but I not sure it would be
worth the effort to make the dates stand out.

Here are the code routines to bold the Wednesdays month by month. The
MonthView is on a UserForm.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Sub BoldWednesdays()

Dim D As Variant
Dim FirstDay As Long
Dim LastDay As Long
Dim M As Long, y As Long

With MonthView1
y = .Year
M = .Month
End With

FirstDay = DateSerial(y, M, 1)
LastDay = DateSerial(y, M + 1, 1) - 1

DoEvents

For D = FirstDay To LastDay
If Weekday(D, vbSunday) = 4 Then
MonthView1.DayBold(D) = True
End If
Next D

End Sub

Private Sub MonthView1_MouseMove(ByVal Button As Integer, ByVal Shift
As Integer, ByVal x As stdole.OLE_XPOS_PIXELS, ByVal y As
stdole.OLE_YPOS_PIXELS)

Dim Ret

Ret = MonthView1.HitTest(x, y, MonthView1.Value)
Select Case Ret
Case Is = 8, 9
BoldWednesdays
End Select

End Sub

Private Sub UserForm_Activate()

BoldWednesdays

End Sub
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Sincerely,
Leith Ross



All times are GMT +1. The time now is 12:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com