PC Review


Reply
Thread Tools Rate Thread

Active X CAlender day colour

 
 
Joel
Guest
Posts: n/a
 
      22nd Mar 2008
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
 
Reply With Quote
 
 
 
 
Leith Ross
Guest
Posts: n/a
 
      22nd Mar 2008
On Mar 21, 4:08 pm, Joel <J...@discussions.microsoft.com> 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
 
Reply With Quote
 
Joel
Guest
Posts: n/a
 
      27th Mar 2008
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 <J...@discussions.microsoft.com> 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
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Remove background colour on calender, Help Tony Wilde Microsoft Outlook Discussion 0 31st Jul 2008 11:49 AM
Help with Calender Day colour Joel Microsoft Excel Programming 2 30th Mar 2008 12:00 AM
Calender Colour Labels =?Utf-8?B?U3VlMDUwNg==?= Microsoft Outlook Calendar 1 10th Nov 2005 02:05 PM
Colour coding calender items =?Utf-8?B?TWF4ZWxjYXQ=?= Microsoft Outlook Calendar 1 20th Jul 2005 05:00 PM
outlook calender :colour face dates in the mont calender stefan Microsoft Outlook Calendar 1 16th Sep 2003 01:30 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:52 PM.