none
VBA Calendar Function RRS feed

  • Question

  • I have Rod Gill's book, VBA PROGRAMMING FOR MICROSOFT OFFICE PROJECT.  It has helped me immensely. 

     

    Something I could not find, however, is a calendar combo box.  Is that possible?  Example – when I click on a date field in Project, I can get a calendar from which to select another date.  Is it possible to create a function that would invoke that in VBA something like “Date?”? when creating a prompt for a filter?

    regards

    GEM1941

    Tuesday, March 8, 2011 6:02 PM

Answers

  • GEM1941,

    Is it possible? Yes. Years ago (circa Project 2003) I wrote a macro that included a Userform with a couple combo boxes that used the DTPicker control, which does exactly what you want. I found the control in this directory:

    C:\Windows\system32\MSCOMCT2.OCX

    As far as I know, the DTPicker control is only available on a UserForm, but you can incorporate that as part of your VBA code. To access the control, from the VB Editor window go to View/Toolbox. This will show the basic UserForm controls. You can add more controls via Tools/Additional Controls.

    What I don't know is if and how this has changed with later versions of Project (e.g. Project 2010), but hopefully this will give you a starting point.

    John

    Wednesday, March 9, 2011 2:33 AM

All replies

  • GEM1941,

    Is it possible? Yes. Years ago (circa Project 2003) I wrote a macro that included a Userform with a couple combo boxes that used the DTPicker control, which does exactly what you want. I found the control in this directory:

    C:\Windows\system32\MSCOMCT2.OCX

    As far as I know, the DTPicker control is only available on a UserForm, but you can incorporate that as part of your VBA code. To access the control, from the VB Editor window go to View/Toolbox. This will show the basic UserForm controls. You can add more controls via Tools/Additional Controls.

    What I don't know is if and how this has changed with later versions of Project (e.g. Project 2010), but hopefully this will give you a starting point.

    John

    Wednesday, March 9, 2011 2:33 AM
  • Hi GEM1941,

    John is correct that you can use the DTPicker control from the given ocx.

    Be careful though as working with non-standard controls can result in problems if the macro is used on non-identical machines (the ocx might not be available, different version, ...) So make sure to test this thoroughly before using non-standard controls.

    Regards,
    Hans


    My EPM blog: Projectopolis
    Wednesday, March 9, 2011 7:58 AM
    Moderator