none
OL2010 VBA Date picker RRS feed

  • Question

  • Trying to port a VBA program from OL2003 (XP 32Bit OS & Office)  to OL2010 (Win7 64Bit OS & Office) . The program uses mscomct2.ocx which even though I can register on W7 appears wont work. I see that there is OlkDateControl  in OL2010 but from what I can tell it only works on Outlook forms, not VBA forms.

    How would I go about getting a date picker control on a OL2010 VBA form?

    Thanks

    Wednesday, July 4, 2012 11:44 PM

Answers

  • Your options are what has been mentioned already:
     
    1. Use a form region with a COM addin (not VBA) and use the OLK* controls.
    2. Use the Win32 approach
    3. Purchase a 3rd party calendar control.
    4. Search on the Web for calendar controls that might be freeware.

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "Shark Diver" <=?utf-8?B?U2hhcmsgRGl2ZXI=?=> wrote in message news:c35b9d97-c6c4-4905-8448-97251f432560...

    After playing around all day I give up!

    Is there any way in OL2010 to pop-up some sort of UI for selecting a date? Even a built in cal in OL would be OK. I have some code from OL2003 that lets the user select a date and then moves tasks to the date. I need some way for the user to choose the date.


    Ken Slovak MVP - Outlook
    Friday, July 6, 2012 2:22 PM
    Moderator

All replies

  • I believe most older ActiveX controls cannot be used in 64-bit Outlook, so unless you can find one you are out of luck.  You'd have to use a Form Region (and the OlkDateControl) or a .NET COM Add-in.  If your UI is suitable for "grafting" onto an Outlook item than a Form Region would be easiest.  Note that you can't use Olk controls with the Form Region Designer in a VSTO project, only the Outlook Form Region Designer.

    Eric Legault
    MVP (Outlook)
    About me...
    Time-saving Outlook Appins
    for as low as $5!

    Thursday, July 5, 2012 3:27 AM
    Moderator
  • Many of the older OCX (ActiveX controls are not included in the version of the VB runtime included with Windows Vista or later. However, you still can use the underlying Win32 API's that the OCX's used.
     
    I haven't bothered to do that with the date picker myself, but I have used the various file dialogs such as file open and file save that way. In this case the date picker is available in Comctl32.dll, which is included in later versions of Windows. You just need to create a class that wraps your call to Comctl32.dll just as the old OCX did.

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "Eric Legault [Outlook MVP]" <=?utf-8?B?RXJpYyBMZWdhdWx0IFtPdXRsb29rIE1WUF0=?=> wrote in message news:19d81f68-c941-4cdd-a75b-4c6735c1df32...
    I believe most older ActiveX controls cannot be used in 64-bit Outlook, so unless you can find one you are out of luck.  You'd have to use a Form Region (and the OlkDateControl) or a .NET COM Add-in.  If your UI is suitable for "grafting" onto an Outlook item than a Form Region would be easiest.  Note that you can't use Olk controls with the Form Region Designer in a VSTO project, only the Outlook Form Region Designer.

    Eric Legault
    MVP (Outlook)
    About me...
    Time-saving Outlook Appins
    for as low as $5!


    Ken Slovak MVP - Outlook
    Thursday, July 5, 2012 2:29 PM
    Moderator
  • I was able to create the datepicker using APIs, but doing anything with it - even as simple as setting/reading the date is a big procedure.

    Is there a control I can use in OL2010 64?

    I was also able to add the OlkDateControl  to a regular Outlook form. Is there a way to manipulate this form so it acts like a VBA form (pop up via macro, only item on the form is the date picker, top most window, no border, not sizeable, etc)?

    Thursday, July 5, 2012 4:35 PM
  • You'd have to create your own controls or purchase commercially available controls, if there are any that would work with VBA and x64 at all.
     
    Use of the OLK* controls for anything other than form regions is not supported. While they may appear to work in standard Outlook forms they are not supported for that usage and may or may not blow up at some undetermined time. If you have any problems with those controls in standard forms you're on your own.
     
    The OLK* controls are what they are and can't be manipulated as you want, and they won't work at all with VBA.

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "Shark Diver" <=?utf-8?B?U2hhcmsgRGl2ZXI=?=> wrote in message news:a6f71f79-9b63-4990-aac2-c4b486929375...

    I was able to create the datepicker using APIs, but doing anything with it - even as simple as setting/reading the date is a big procedure.

    Is there a control I can use in OL2010 64?

    I was also able to add the OlkDateControl  to a regular Outlook form. Is there a way to manipulate this form so it acts like a VBA form (pop up via macro, only item on the form is the date picker, top most window, no border, not sizeable, etc)?


    Ken Slovak MVP - Outlook
    Thursday, July 5, 2012 5:52 PM
    Moderator
  • After playing around all day I give up!

    Is there any way in OL2010 to pop-up some sort of UI for selecting a date? Even a built in cal in OL would be OK. I have some code from OL2003 that lets the user select a date and then moves tasks to the date. I need some way for the user to choose the date.

    Friday, July 6, 2012 5:47 AM
  • Your options are what has been mentioned already:
     
    1. Use a form region with a COM addin (not VBA) and use the OLK* controls.
    2. Use the Win32 approach
    3. Purchase a 3rd party calendar control.
    4. Search on the Web for calendar controls that might be freeware.

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "Shark Diver" <=?utf-8?B?U2hhcmsgRGl2ZXI=?=> wrote in message news:c35b9d97-c6c4-4905-8448-97251f432560...

    After playing around all day I give up!

    Is there any way in OL2010 to pop-up some sort of UI for selecting a date? Even a built in cal in OL would be OK. I have some code from OL2003 that lets the user select a date and then moves tasks to the date. I need some way for the user to choose the date.


    Ken Slovak MVP - Outlook
    Friday, July 6, 2012 2:22 PM
    Moderator