what type is calendar control

running Excel 2003 (going to 2007 in the next few months)

I have inserted a pop-up calendar (Insert/Object.../Calendar Control
11.0). No problems getting it to do what I want - except when I
declare my variables (Option Explicit).

I can't seem to determine what type the Calendar object is - Dim
Calendar as Object returns a "Block Not Set" error.

Any sugegstions?

Art
0
c1802362
11/16/2009 1:55:00 PM
excel.programming 6508 articles. 2 followers. Follow

6 Replies
769 Views

Similar Articles

[PageSpeed] 42

You put this calendar control directly on the worksheet, not a UserForm, 
correct? I think you can do it this way...

Dim MyCalendar As Object
Set MyCalendar = Worksheets("Sheet2").OLEObjects("Calendar1").Object
MsgBox MyCalendar.Value

-- 
Rick (MVP - Excel)


"c1802362" <c1802362@cox.net> wrote in message 
news:78012296-7c10-4576-8b14-f38f3272c0f6@f20g2000vbl.googlegroups.com...
> running Excel 2003 (going to 2007 in the next few months)
>
> I have inserted a pop-up calendar (Insert/Object.../Calendar Control
> 11.0). No problems getting it to do what I want - except when I
> declare my variables (Option Explicit).
>
> I can't seem to determine what type the Calendar object is - Dim
> Calendar as Object returns a "Block Not Set" error.
>
> Any sugegstions?
>
> Art 

0
Rick
11/16/2009 3:56:50 PM
Art,

This works for me:

Private Sub Calendar1_Click()
Dim myCal As Calendar
Set myCal = Calendar1
MsgBox myCal.Value
End Sub


HTH,
Bernie
MS Excel MVP


"c1802362" <c1802362@cox.net> wrote in message 
news:78012296-7c10-4576-8b14-f38f3272c0f6@f20g2000vbl.googlegroups.com...
> running Excel 2003 (going to 2007 in the next few months)
>
> I have inserted a pop-up calendar (Insert/Object.../Calendar Control
> 11.0). No problems getting it to do what I want - except when I
> declare my variables (Option Explicit).
>
> I can't seem to determine what type the Calendar object is - Dim
> Calendar as Object returns a "Block Not Set" error.
>
> Any sugegstions?
>
> Art 


0
Bernie
11/16/2009 3:56:54 PM
On Nov 16, 10:56=A0am, "Rick Rothstein"
<rick.newsNO.S...@NO.SPAMverizon.net> wrote:
> You put this calendar control directly on the worksheet, not a UserForm,
> correct? I think you can do it this way...
>
> Dim MyCalendar As Object
> Set MyCalendar =3D Worksheets("Sheet2").OLEObjects("Calendar1").Object
> MsgBox MyCalendar.Value
>
> --
> Rick (MVP - Excel)
>
> "c1802362" <c1802...@cox.net> wrote in message
>
> news:78012296-7c10-4576-8b14-f38f3272c0f6@f20g2000vbl.googlegroups.com...
>
>
>
> > running Excel 2003 (going to 2007 in the next few months)
>
> > I have inserted a pop-up calendar (Insert/Object.../Calendar Control
> > 11.0). No problems getting it to do what I want - except when I
> > declare my variables (Option Explicit).
>
> > I can't seem to determine what type the Calendar object is - Dim
> > Calendar as Object returns a "Block Not Set" error.
>
> > Any sugegstions?
>
> > Art

yes - the code puts it directly on the page when the user clicks in
the referenced cell

Art
0
c1802362
11/17/2009 1:11:44 AM
On Nov 16, 10:56=A0am, "Bernie Deitrick" <deitbe @ consumer dot org>
wrote:
> Art,
>
> This works for me:
>
> Private Sub Calendar1_Click()
> Dim myCal As Calendar
> Set myCal =3D Calendar1
> MsgBox myCal.Value
> End Sub
>
> HTH,
> Bernie
> MS Excel MVP
>
> "c1802362" <c1802...@cox.net> wrote in message
>
> news:78012296-7c10-4576-8b14-f38f3272c0f6@f20g2000vbl.googlegroups.com...
>
>
>
> > running Excel 2003 (going to 2007 in the next few months)
>
> > I have inserted a pop-up calendar (Insert/Object.../Calendar Control
> > 11.0). No problems getting it to do what I want - except when I
> > declare my variables (Option Explicit).
>
> > I can't seem to determine what type the Calendar object is - Dim
> > Calendar as Object returns a "Block Not Set" error.
>
> > Any sugegstions?
>
> > Art

I'll try this, but when I started typing my Dim statement (Dim
Calendar1 As ....) I couldn't get an object description with Calender
in it

(Which is why I asked the question in the first place - thanks!)
0
c1802362
11/17/2009 1:14:43 AM
Once you add the calendar to your sheet, double click it, and then the 
calendar click event code window will open and you can type

Dim Calendar1 As Cal

and the Calendar object type will be available in the autocomplete of the 
declaration.

Bernie


"c1802362" <utay1@cox.net> wrote in message 
news:1734d8ff-e752-46a0-ba78-483a22042e0f@v25g2000yqk.googlegroups.com...
On Nov 16, 10:56 am, "Bernie Deitrick" <deitbe @ consumer dot org>
wrote:
> Art,
>
> This works for me:
>
> Private Sub Calendar1_Click()
> Dim myCal As Calendar
> Set myCal = Calendar1
> MsgBox myCal.Value
> End Sub
>
> HTH,
> Bernie
> MS Excel MVP
>
> "c1802362" <c1802...@cox.net> wrote in message
>
> news:78012296-7c10-4576-8b14-f38f3272c0f6@f20g2000vbl.googlegroups.com...
>
>
>
> > running Excel 2003 (going to 2007 in the next few months)
>
> > I have inserted a pop-up calendar (Insert/Object.../Calendar Control
> > 11.0). No problems getting it to do what I want - except when I
> > declare my variables (Option Explicit).
>
> > I can't seem to determine what type the Calendar object is - Dim
> > Calendar as Object returns a "Block Not Set" error.
>
> > Any sugegstions?
>
> > Art

I'll try this, but when I started typing my Dim statement (Dim
Calendar1 As ....) I couldn't get an object description with Calender
in it

(Which is why I asked the question in the first place - thanks!) 

0
Bernie
11/17/2009 1:29:32 AM
And I forgot to add that inserting a calendar control automatically adds a 
reference to the calendar control in your VBA project.

Bernie


"c1802362" <utay1@cox.net> wrote in message 
news:1734d8ff-e752-46a0-ba78-483a22042e0f@v25g2000yqk.googlegroups.com...
On Nov 16, 10:56 am, "Bernie Deitrick" <deitbe @ consumer dot org>
wrote:
> Art,
>
> This works for me:
>
> Private Sub Calendar1_Click()
> Dim myCal As Calendar
> Set myCal = Calendar1
> MsgBox myCal.Value
> End Sub
>
> HTH,
> Bernie
> MS Excel MVP
>
> "c1802362" <c1802...@cox.net> wrote in message
>
> news:78012296-7c10-4576-8b14-f38f3272c0f6@f20g2000vbl.googlegroups.com...
>
>
>
> > running Excel 2003 (going to 2007 in the next few months)
>
> > I have inserted a pop-up calendar (Insert/Object.../Calendar Control
> > 11.0). No problems getting it to do what I want - except when I
> > declare my variables (Option Explicit).
>
> > I can't seem to determine what type the Calendar object is - Dim
> > Calendar as Object returns a "Block Not Set" error.
>
> > Any sugegstions?
>
> > Art

I'll try this, but when I started typing my Dim statement (Dim
Calendar1 As ....) I couldn't get an object description with Calender
in it

(Which is why I asked the question in the first place - thanks!) 

0
Bernie
11/17/2009 1:31:16 AM
Reply:

Similar Artilces:

moving control looses variable value??
hi i have a var in my class code:------------------------------------------------------ -------------------------- class CGoServerData : public CObject { protected: DECLARE_DYNCREATE(CGoServerData) // Construction public: CGoServerData(); protected: UINT m_nTotalClients; }; ----------------------------------------------------------- --------------------- code:------------------------------------------------------ -------------------------- CGoServerData::CGoServerData() { m_nTotalClients = 0; } ----------------------------------------------------------- --------------------- but when...

calendar shows 12am-12am
for some reason, even though i have set the days to have the starting time start at 9am, i open my calendar and it shows the start time as 12am. is there any fix? Outlook 2003 I have adjusted the options. The calendar always shows all the hours of a day but shades the work day differently. "********Meg" <alumni(removethis)@swedishinstitute.edu> wrote in message news:##98iCTsIHA.5068@TK2MSFTNGP02.phx.gbl... > for some reason, even though i have set the days to have the starting time > start at 9am, i open my calendar and it shows the start time as 12am. is &...

setting timeout in XML controls
Is there a way to set a timeout in either MSXML or in .NET's XML classes? --Buddy Hi, If you're using MSXML4.0 take a look at the ServerXMLHTTP: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/htm/xml_mth_sz_0cj7.asp Regards, Ion Vasilian -- This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm. "Buddy Ackerman" <buddy@buddyackerman.com> wrote in message news:uHqaoAkmDHA.2068@TK2MSFTNGP09.phx.gbl...

Pie of Pie Chart type with smaller pie showing slices of main slic
Hi How can I do the following: Lets say I have the following labels and data For the main pie I have A,B,C labels with A =5, B =10, and C =20. So my main pie would show 3 slices with C being the largest slice. To do this I highlight the 3 labels and their data and choose Insert, Pie, Pie in a Pie to show a main pie on the left with 3 slices and a smaller solid pie to the right with series lines connectiing them. I want to show the solid smaller pie on the right in several slices to show how the C slice of 20 is broken down. lets say the main slice C of 20 is made up ...

Set control AfterUpdate event to procedure in another module
Hi, i know i can set a controls AfterUpdate event to a user defined procedure if it is in the same module as the code, however is it possible to set it to a procedure in a different module? i.e. By setting in the OnFormLoad() event: cbo.AfterUpdate = "=Module1.Translate()" I cant get it to work, it just says "the expression you entered has a function name that microsoft office access cannot find". The Translate procedure is public. Any thoughts much appreciated. Thanks in advance, Chris If Module1 is a standard module (not a class module, and not the module of a form...

Typing in macros
I have made a few macros and use them in word and excel 2000. When I see typed out macros on the message boards I am not quite sure how to use them. Do I go into the editor, type them in and then link them with a button on the toolbar? What module do I put them in and is there one for the personal worksheet. I have been struggling with the syntax of Visual Basics for years. Just need a step by step explanation. Thank You Sue In general, the macros you see in the groups are likely to be ordinary macros that will go into a general module in the VBE, eg:- Hit ALT+F11 and this will...

Open File Dialog to fileter multiple file types at once...?
Hello, Here is another quick one for you all. The solution is probably simple, but I cannot find the answer anywhere. I have the following code: CFileDialog OpenDlg(TRUE, NULL, NULL, OFN_ALLOWMULTISELECT | OFN_HIDEREADONLY, ""); // Later must set this to retrieve a value from the registry OpenDlg.m_ofn.lpstrInitialDir = "c:\\"; OpenDlg.m_ofn.lpstrFilter = "txt Files\0*.txt\0Doc Files\0*.doc\0"; OpenDlg.DoModal(); I am trying to get the box to filter out everything but the *.doc and the *.txt files ... I have seen some boxes that have something that...

Controlling odd even rows when pasting data
I want to paste data into an excel sheet. But I want to paste one large amount of data into even rows, then an equally large amount of it into odd rows. How do I direct the data to be pasted to only the assigned rows? est 3000 to five thousand rows of data into each paste. Thanks in advance john.corriganREMOVE-NO-SPAM@msn.com John, This code does the data transfer for the even rows only... '--------------------------------------- 'Transfer data from each row in rngTwo into 'the even numbered rows in rng one. 'Jim Cone - San Francisco, USA - Feb 23, 2005 Sub OddManOut...

Rectification of wrong posting type
Hi There is one PL account say "Mic Expenses" has got wrong posting type "Balance sheet", when we closed the year 2005 ,System has brought forward the balance of that account into next year 2006, which otherwise should have been gone into the Retain Earning of 2006, is there any option to rectify this error, other then passing rectifying JV in 2005(coz in that case if I take last year TB then ending balance of this account would be Zero) or restoring the backup and doing closing procedure again. Thanks in Advance Shabnam There is a Article ID for this in partner s...

Some chart types cannot be combined with other chart types?
Hi, I am getting the above error message everytime I try to insert a chart or any type into a completely blank presentation using either the Insert, Chart command or the Insert Chart button in the Title and Content slide layout. I am using 2007. Any help or suggestions would be appreciated. TIA, Shane Devenshire Try running Office Diagnostics, Shane. Open PPT or Excel, hit the Office button, then <app> Options | Resources. I think that may resolve this issue. -- Echo [MS PPT MVP] http://www.echosvoice.com What's new in PPT 2007? http://www.echosvoice.com/2007...

calendar responses to not show for the invitee
I schedule meetings for my boss and use outlook calendar to send the invite on her behalf but she does not want to see all the feedback (excepted, declined, etc). How can I block her from seeing all that but yet show me on my calendar the responses from the invites? There's a setting on your Boss' Delegates tab to have all meeting related emails sent only to their Delegate (that's you). Regards Judy Gleeson MVP Outlook "enza" <enza@discussions.microsoft.com> wrote in message news:8D6AF880-E619-4C39-93DD-9580D29E513F@microsoft.com... >I s...

Why can't I separate my mailbox & calendar
This is more of a moan :( than a question as I see this all the time (and I class myself as an end user here as I have no control over the server side of things.) In large corporates Mailbox size is necessarily restricted so people use datafile PST's to keep their mail in (I know this is not correct but it's a reality) However this means the calendering and more inportantly mobile mail/calendar breaks as it is no longer on the server. :confused: Mail is a user choice, either shrink it or move it. I personally recieve on average more than 200 mails a day and 30% have lar...

need help to declard type=IntType instead type="xsd:int" with xml schema
Hi, I am writing C# code to produce xml schema. //Create attribute XmlSchemaAttribute att2 = new XmlSchemaAttribute(); att2.Name = "CustomerID"; att2.SchemaTypeName = new XmlQualifiedName("int",schemaNS); att2.Use = XmlSchemaUse.Required; ct.Attributes.Add(att2); I need to produce schema with custom data type instead of the xsd:string or xsd:int The code above will produce the following schema <?xml version="1.0" encoding="utf-8"?> <xsd:schema attributeFormDefault="unqualified" version="1.0" xmlns:xsd=...

Scatterplots with different colors based on Type of Data
Is it possible to plot a scatterplot with different colors for 2 sets of data? E.g Type of Agreement MRP Discount% Limited 10 5% UnLimited 20 10% I want to show different colors for Limited & Unlimited. Is it possible to plot scatterplots on both axis(Primary & Secondary) Please let me know. Thanks, Satish If I use this range to make a chart Limited 10 5% Unlimited ...

outlook type interface
I have an SDI application and want to change it so I have a split window, on the left I want a TreeControl above a 'PropertyGrid' control. Then my exisiting SDI Client in the space on the right Can anyone point in the right direction to achieve this Any help will be much appreciated Thanks Phil You need to use two CSplitterWnds (as members of your CMainFrame). Override CMainFrame::OnCreateClient and create a vertical splitter as the main child (i.e. 1 row, 2 cols). Then you want to create a horz splitter as a child of the left-hand pane of the main splitter (which has 2 rows, 1 c...

VSTO Excel 2003 to VB 6.0 Type mismatch
Hi, I have an Addin 2003 Application. In this Application I'm calling an VB 6.0 Dll and I send Excel Application Object as Parameter. In VB Project I'm using Workbook_Open event with WithEvents. I have a messagebox there. Unfortunately when i call VB dll , I get this Error Message -- > Type mismatch. Is there any Idea? Code in VS2008 : private Project1.Class1 vbapp; private void ThisAddIn_Startup(object sender, System.EventArgs e) { #region VSTO generated code this.Application = (Excel.Application)Microsoft....

predictive typing of addressee
I am frequently sending sensitive email to a person who has a very common name. More than once I have almost sent the email to the wrong party because of the Outlook feature that predicts the addressee name. Does anyone know how to eliminate names from the dropdown list that appears as you type tha addressee name? Or is there a way to stop addressee names from appearing automatically as you type in the "To" field. Any help will be appreciated. joanne Use arrow keys to highlight error address, then hit Delete Btn Do you use Contacts?, hitting the 'To' Btn will bri...

How do you Change Font Size when printing the Calendar
When I print out my monthly calendar, I cannot read all of the entry because the font size is too large. So, I was trying to figure out if you can change the size of the font that is used when printing out a copy of the Monthly Calendar. I have changed all the settings for font sizes under General Preferances and it has had no effect. Does anyone know if this can be done and if so, How? Thank you in advance. SBS1 Hi I don't think the fonts are user controllable, but I do think this would be a great feature to request. Please take a moment to use the Send feedback to Microsoft with ...

"Can't change data type" error
I'm trying to reduce the field size of text fields in my database. They defaulted to 255 characters when I created my database but in many cases I only need a size of around 20. When I enter the reduced size for one field in the table design view and try to save the change to that field I get the following errors: "Microsoft Access can't change the data type. There isn't enough diskspace or memory." When I click OK to the above I then get the following message: "Errors were encountered durnig the save operation. Data types were not changed. Properties w...

How to convert CString type to LPCSTR type
Hi, I have a CString type variable, and I need to convert it's to LPCSTR type ,what I can do! example: CString m_strExecFile(_T("C:\\\\aa.exe")); next I want to call WinExec Command to execute this file LPCSTR lpcstr ; lpcstr = m_strExecFile.GetBuffer(); WinExec(lpcstr,SW_SHOW); BUT the compilier tells me it can not convert w_char * to LPCSTR type! Why? ps. I use vs2005 program in UNICODE mode. Any helpful ideas would be highly appreciated! -joseph Why use a CString in this case at all, if all you are doing is using it in WinExec. Something ...

Aggregate data types mismatch
Using reporting services 2008. Getting a really weird error when calculating a variance between a budget and actual amount in the report. Both the underlying fields are of data type 'money', but when performing the calc in the report writer, i am getting the following error: [rsAggregateOfMixedDataTypes] The Value expression for the textrun 'Variance_MTD_ActualvsBudget1.Paragraphs[0].TextRuns[0]' uses an aggregate function on data of varying data types. Aggregate functions other than First, Last, Previous, Count, and CountDistinct can only aggregate data of a si...

Active X Calendar
I know I asked this already and the general response is use a pop-up calendar, I would rather not. How can I click on the Activex Calendar and have it transfer the date to a text box ? Thanks Thanks - That Works ... Can you also tell me what I have to do to make the calendar keep the correct date, it seems to be stuck on the date I installed it in my form. George "Analyst72" wrote: > Add the following code in the Active X Calendar's double click event > > me.textboxname = me.activexcalendarname.value > > "George" wrote: > > > I know...

Control if a form updates table
I would like to know how best to accomplish this data entry form requirement. I have a form with a number of fields which is linked to a table. When the operator opens the form i would like all the fields to be blank and the user can tab through the fields as necessary. I have two command buttons. One allows to exit the form (all set with that one) with no saving of the form data, while the second button opens a message box which asks the operator if they wish to submit the information on the form (within the fields) Y/N and the message box has all the data from the fields li...

Change types
I hav got a letter with types that i cannot understand. When i mark some of the words, tells me that this type is sansserif. I think that this is a joke but i cannot find out how to change to arial or times new roman ...

Determining address of value type variables
How to get the address of(memory location) value type variables? GetHashCode() returns only value and not its address Thank you Regards Raj "Raj" wrote: > How to get the address of(memory location) value type variables? > > GetHashCode() returns only value and not its address > > Thank you > > Regards > Raj An address in memory and a hashcode have nothing to do with each other. You should rarely, if ever, need to get an address of any .net object. To get an address in memory, you need to use unsafe code and the "&a...