De: Jay Freedman Objet: Re: show calendar Date : lundi 4 octobre 1999 17:56 It turned out to be amazingly easy to do. All the hard work of making a calendar is done already in a "control" called MSCAL.OCX, and you just have to make a dialog to display it. Follow these steps. 1. Go to tools/Macro/Macros. Enter a name for a new macro, such as Calendar (original, no?) and select the template to save the macro in. (See below.) Click the Create button, which opens the VBA editor. 2. In the VBA editor, select Insert/Userform. This displays another window in the editor with a blank dialog box titled Userform1, and you should see the toolbox. Right-click a blank spot in the toolbox and select additional Controls. 3. In the additional Controls dialog, scroll down and find "Calendar Control 9.0". (The number may be different; that's OK. if you don't see any Calendar Control at all, you'll have to download it from http://www.microsoft.com/OfficeDev/FreeStuff/mscaldl.htm.) Put a check mark in the box next to its name. The Location box should show a path like C:\Program Files\Microsoft Office\Office\MSCAL.OCX (again, the path may be different but the file name at the end should be the same.) Click OK, and a new icon will appear in the toolbox. 4. Click once on the calendar icon in the toolbox. Now click-and-drag a rectangle on the face of the Userform1 dialog so it's the size you want the calendar to appear. When you let go, by the magic of OLE, the calendar should appear. 5. Go back to the toolbox, locate the Command Button icon, click it once, and drag a small rectangle below the calendar in Userform1. It will turn into a button that says "CommandButton1" (well, a lot of it may be cut off 'cause it doesn't fit). 6. Now we'll clean up the names of things. While the Command Button is highlighted, go over to the Properties list (usually at the lower left), double-click "(name)", and type in btnOK . double-click "Caption" and type in OK . double-click "Default" and select true . then select a blank area in Userform1. In its properties, set its (name) to frmCal and set its Caption to Calendar. 7. double-click the Command Button (which now says "OK"). This will bring up a code window that says "Private Sub btnOK_Click()". After that line, type this line: Unload frmCal That will make the dialog disappear when you click the OK button. 8. On the VBA editor's menu bar, pull down the Window menu and select the "NewMacros (code)" window. You should see a line that says "Sub Calendar". Between that line and the end Sub statement, type the one line frmCal.show That will make the dialog appear when you run the macro. 9. Finally, let's put a button on the Word toolbar for this. select tools/Customize and go to the Commands tab. Scroll down the left list and select Macros. In the right list, find the Calendar macro and drag it up to the toolbar. Right-click it and select Change Button Image, and click an icon. (if you don't like any of the selection you're given, you can right-click again and select Edit Button Image.) Right-click the button again and select Default Style to get rid of the long macro name, leaving just the icon. It's really not a good practice to put personal macros into Normal.dot. for one thing, since Normal.dot is used constantly, it's the one template that's most susceptible to corruption when (not if) Word crashes. It's also the most common target of macro viruses. if you have to blow away Normal.dot to cure one of these problems, you lose all your macros and other customizations as well. It's much better to keep another template just for your macros, toolbars, etc. don't put any text in it. Put that template into Word's Startup directory, and its macros and other items will be available in all documents. Be sure to back it up regularly, and especially when you change it. Stéphane Royer wrote in message news:eE81jvnD$GA.180@cppssbbsa04... > :-(( > does anybody have a little idea ? > > Bye > > Stéphane > > > > > Stéphane Royer a écrit dans le message ... > >Helloo > > > >In many applications, we find the possibility for the user to call a small > >calendar (usually by the way of shortcut like Ctrl Space), so that he can > >pick a date (day date, past or future date) > > > >Can we do this with word ? This will be very useful, won't it ? > > > >Bye > >Stéphane > > > > > > > > > >