View Single Post
  #13   Report Post  
Posted to microsoft.public.excel.programming
Steen Steen is offline
external usenet poster
 
Posts: 104
Default Calendar with weeknumber?

Hi again Rick

Thanks - it works nice.

But I have got a small problem - I can't call it from another module/sheet
with:

Call OpenCalendar

Is that because it's defined in the Prival.xls

"Steen" wrote:

Hi again Rick

Thanks for the quick answer - I will try i tomorrow an let you know how it
went :-)

/Stony

"Rick Rothstein (MVP - VB)" skrev:

I took a quick look at the link you provided. I believe you can follow all
directions shown and you can use the MonthView control in place of the
Calendar control shown there; HOWEVER, you need to make these minor
modification in order for everything to work. First, after placing the
MonthView control on the form, rename it to Calendar1; that way, you can use
the code exactly as written. Second, the MonthView control does not have a
Click event; rather, it has a DateClick event. So, you will have to change
this procedure header used in the code from the link you provided...

Private Sub Calendar1_Click()

to this instead...

Private Sub Calendar1_DateClick(ByVal DateClicked As Date)

Making the two indicated changes above should (remember, I didn't test it)
allow you to use the rest of the code/implementation exactly as described in
the text at that link. Just so you know, the size of the MonthView control
is set by the size of the font, not by dragging the sizing handles. So, to
resize it, use the Font property from the Properties window.

Rick


"Steen" wrote in message
...
Hi again Rick

Just a little correction - this is the code I am using for the Calendar
control:
http://www.fontstuff.com/vba/vbatut07.htm

"Steen" skrev:

Hi Rick

That's just great - just what I wanted :-)

I am using it in a userform almost in the way describe in

http://www.rondebruin.nl/calendar.htm

Will the code work for this control too?

"Rick Rothstein (MVP - VB)" skrev:

Okay, it depends on where you are putting the MonthView control at....
directly on the spreadsheet or on a UserForm from within the VBA
development
area.

From the spreadsheet
=====================
If you don't already have the Visual Basic toolbar showing, click...

View/Toolbars/Visual Basic

on Excel's menu bar. On the toolbar that displays, there is an icon
that
looks like a hammer and wrench crossing each other... that is the
Control
Toolbox... click it and then click the same looking icon on the panel
that
displays (the ToolTip for it says "More Controls"). From the list box
that
appears, select Microsoft MonthView Control 6 (at least, it shows 6 on
my
system). That will place a MonthView control on the spreadsheet
directly.
Right click the MonthView calendar that appears and click on Properties
in
the popup menu that appears. Set the ShowWeekNumbers property to True
to
show the week numbers on the calendar. You might have to change the
TitleBackColor property in order to make the numbers easier to see
(depending on the theme setting for your copy of Windows). You can use
the
LinkedCell property to specify the cell you want to show the selected
date.

On a UserControl
====================
Right click the Sheet1 tab at the bottom of the sheet and select View
Code
from the popup menu (or press Alt+F11) to get into the VBA editor. You
can
add a UserForm to your project by clicking Insert/UserForm from the VBA
editor's menu bar. Right click anywhere on the Toolbox panel that comes
up
with the UserForm when you add it. Find Microsoft MonthView Control 6
on the
list that appears and check it off. This will put the MonthView icon
into
the Toolbox... find the icon, click it and then drag-draw the control
into
the Userform. If the Properties window is not showing, right click the
calendar and select Properties from the popup menu. Set the
ShowWeekNumbers
property to True to show the week numbers on the calendar. You might
have to
change the TitleBackColor property in order to make the numbers easier
to
see (depending on the theme setting for your copy of Windows).

Okay, that makes the MonthView control available. What you do next
depends
on how you want to interact with the user and what you know about how
to do
that. It is a little hard to guide you further at this point.

Rick



"Steen" wrote in message
...
Hi Again

I have just taken a quick view at your suggestion, and I am not sure
how
to
find and use this MonthView control. I am not a skilled vba
programmer,
but
uses all the good information on your site among others.

Could you please ad a little more info on how to do?


"Steen" skrev:

Hi both of you two

I sorry that I first am back now - I havn't had time yet to test the
two
suggestions, but I will do that in the weekend and come back.

/Stony

"Rick Rothstein (MVP - VB)" skrev:

I am using the Calendar Control v11, and would like to know if
it
could be
possible to display the weeknumber in it as is the case in
OutLook.

If you use a MonthView control instead, it has a ShowWeekNumbers
property
that can be set to True in order to display the week numbers.

Rick