View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Leith Ross[_2_] Leith Ross[_2_] is offline
external usenet poster
 
Posts: 128
Default OleObjects add monthview

On Nov 1, 10:08 am, "K Warner" wrote:
Using Excel 2007.
Can someone tell me how to add a MonthView oleObject to a worksheet using
VBA?
I have tried: (aSheet has been set to the ActiveSheet)
Set oleMonthView = aSheet.OLEObjects.Add _
(ClassType:="forms.MonthView")

Set oleMonthView = aSheet.OLEObjects.Add _
(ClassType:="forms.MonthView.1")

Set oleMonthView = aSheet.OLEObjects.Add _
(ClassType:="forms.microsoft monthview control")

+ a few other variations.

I always get Runtime error '1004': Cannot insert object.


Hello Kevin,

You are using the wrong object library. The Month View in not in the
Forms library but in MSComCtl2. This will inset a Month View on the
Active Sheet. Making it interactive is another issue.

ActiveSheet.OLEObjects.Add(ClassType:="MSComCtl2.M onthView")

Sincerely,
Leith Ross