View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
JLatham JLatham is offline
external usenet poster
 
Posts: 3,365
Default Calendar code not working

A last minute thought. You said you'd converted this file from XP format to
2007 format on your home system.

Have you tried taking the XP .xls file to your office and then converting it
to 2007 format on that machine?

"RobN" wrote:

Thankyou for your reply.

1. I can't right click on the control as it doesn't ever appear (I just get
the message saying "Object required".) When I right click on the previous
version's control, where it does work, nothing happens. ie no menu allowing
me to select properties.

2. How do I delete the existing (supposedly faulty) Calendar control? I'm
not even sure how to go about creating a new control in 2007. Do I select
(in the Developer Tab) Insert, then the CalsControl Control option from the
More Controls option. When I try that I get a message (even on a blank new
workbook) that I cannot Insert Object!

3. I do have the mscal.ocx file on my office computer. Should I really
replace that with the XP versions mscal.ocx file from my home computer? Or
should I rename, etc.

I'm sorry, but even though I created the Calendar Control in XP, I don't
really understand what's happening, particularly now that 2007 is so much
different.

Rob

"JLatham" <HelpFrom @ Jlathamsite.com.(removethis) wrote in message
...
My first thought is that your Calendar control may have changed names
during
the copy. Right click the calendar control and choose Properties and see
what the control's name is. If other than Calendar3, then change code to
get
it to work. If you can't see it or get to it for this, read on...

But since it works at home, and not at work - it could be a library
problem.
You may have a calendar that is created with XP version of the calendar
control and it may not exist on your office computer. You may need to
simply delete the calendar in the office file copy and create a new one
based
on the calendar control available on that computer.

Another option is to make a copy of the mscal.ocx file on your home
machine
and make it available on your office system. On my system, the file is
located at c:\Program Files\Microsoft Office\OFFICE11\MSCAL.OCX

"RobN" wrote:

I have the following code to bring up the Calendar control. When I
converted the excel workbook from XP version to 2007 version on my home
computer it worked fine, but when I open it on my office computer I get a
message saying "Object required". When I open the older version on my
office computer, the Calendar code works OK.
Can you please also advise what code I need to control the size of the
Calendar?

Rob

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Cells.Count 1 Then Exit Sub
If Not Application.Intersect(Range("H2"), Target) Is Nothing Then
Calendar3.Left = Target.Left + Target.Width * 2 - Calendar3.Width
Calendar3.Top = Target.Top + Target.Height * 7.5
Calendar3.Visible = True
' select Today's date in the Calendar
Calendar3.Value = Date
ElseIf Calendar3.Visible Then Calendar3.Visible = False
End If
End Sub