mvidas
01-19-2006, 07:34 AM
Hi All,
Having a bit of a problem while using the cal control programmatically.
Can someone do me a favor and run this code?Sub scc()
ActiveSheet.OLEObjects.Add ClassType:="MSCAL.Calendar", Left:=75, Top:=65, _
Width:=225, Height:=150
End SubAssuming design mode is off when it is run, it does add a calendar control to the sheet but it is not interactive. If you turn on design mode then turn it back off, it becomes interactive (and you can see it change color slightly when interactive).
Any ideas what I can do? I left the version off the cal control on purpose as it will probably be run on different machines.
Truth be told, it is for a selection change event, see:Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address(0, 0) <> "D5" Then Exit Sub
Application.EnableEvents = False
With ActiveSheet.OLEObjects.Add(ClassType:="MSCAL.Calendar", Left:=75, Top:=65, _
Width:=225, Height:=150)
.Name = "CalControl1"
End With
Application.EnableEvents = True
End Sub
Private Sub CalControl1_Click()
Range("D5").Value = CalControl1.Value
Shapes("CalControl1").Delete
End Sub
Any help/thoughts/confirmations would be appreciated :)
Matt
Having a bit of a problem while using the cal control programmatically.
Can someone do me a favor and run this code?Sub scc()
ActiveSheet.OLEObjects.Add ClassType:="MSCAL.Calendar", Left:=75, Top:=65, _
Width:=225, Height:=150
End SubAssuming design mode is off when it is run, it does add a calendar control to the sheet but it is not interactive. If you turn on design mode then turn it back off, it becomes interactive (and you can see it change color slightly when interactive).
Any ideas what I can do? I left the version off the cal control on purpose as it will probably be run on different machines.
Truth be told, it is for a selection change event, see:Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address(0, 0) <> "D5" Then Exit Sub
Application.EnableEvents = False
With ActiveSheet.OLEObjects.Add(ClassType:="MSCAL.Calendar", Left:=75, Top:=65, _
Width:=225, Height:=150)
.Name = "CalControl1"
End With
Application.EnableEvents = True
End Sub
Private Sub CalControl1_Click()
Range("D5").Value = CalControl1.Value
Shapes("CalControl1").Delete
End Sub
Any help/thoughts/confirmations would be appreciated :)
Matt