Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default OleObjects add monthview

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.


  #2   Report Post  
Posted to microsoft.public.excel.programming
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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default OleObjects add monthview

Just exactly what I was look for. Thank you so much.
Kevin

"Leith Ross" wrote in message
...
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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default OleObjects add monthview

When I run this code:

Sub MonthViewToSheet()

Dim oMV As OLEObject

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

End Sub

The Monthview is in the sheet, but it is not usable yet. Only when I move to
a different sheet
and then back to sheet with the Monthview can it be used.
What could should I use to make the Monthview usable without moving sheets?
I have tried oMV.Activate and a few other ones, but no success yet.


RBS

"Leith Ross" wrote in message
...
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


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default OleObjects add monthview


"Leith Ross" wrote
This will inset a Month View on the
Active Sheet. Making it interactive is another issue.

You are right about making it interactive. I assume there is something I'm
missing.

With MonthView embedded in the WorkSheet, MonthView events are fired as
expected:

Private WithEvents myMonthview As MonthView
Private oleMonthView As OLEObject
Sub whatever()
Set oleMonthView = aSheet.OLEObjects.Item("MonthView1")
Set myMonthview = oleMonthView.Object
end sub

However, when creating a MonthView this way, the MonthView events are not
fired:
(without myMonthview_DateClick event, this is useless)

Private WithEvents myMonthview As MonthView
Private oleMonthView As OLEObject
Sub whatever()
Set oleMonthView = aSheet.OLEObjects.Add _
(ClassType:="MSComCtl2.MonthView")
Set myMonthview = oleMonthView.Object
end sub


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
monthview object or ?? sherri Excel Discussion (Misc queries) 1 September 14th 08 08:57 PM
OLEObjects NateBuckley Excel Programming 7 June 16th 08 04:38 PM
monthview calendar question/ want the calendar to display weekdays only.. [email protected] Excel Programming 0 August 26th 07 09:25 PM
OLEObjects .. again Roy[_8_] Excel Programming 3 December 17th 04 09:44 AM
Monthview AxtiveX AAI Excel Programming 1 April 18th 04 04:49 PM


All times are GMT +1. The time now is 02:53 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"