title: How can I create a calendar input in VBA Excel?
body: <p><strong>Problem Statement</strong></p>
  
  <p>In VBA, three main kinds of date time controls can be used provided certain ocxs have been registered using <a href="https://social.msdn.microsoft.com/Forums/en-US/91cf3127-70fe-4726-8a27-31b8964430c5/registering-mscomct2ocx-in-64-bit-windows-7?forum=sbappdev" rel="noreferrer">administrator rights</a>. These are VB6 controls and are not native to VBA environment. To install the <em>Montview Control</em> and <em>Datetime Picker</em>, we need to set a reference to <em>Microsoft MonthView Control 6.0 (SP4)</em> which can only be accessed by elevated registration of <em>mscomct2.ocx</em>. Similarly for <em>mscal.ocx</em> and <em>mscomctl.ocx</em>. Having said that, the <em>deprecated mscal.ocx</em> may or may not work on Windows 10. </p>
  
  <p>Depending on your Windows and Office versions (32 bit or 64 bit), it can be really painful to register these ocxs.</p>
  
  <p>The <em>Monthview Control</em>, <em>Datetime Picker</em> and the <em>deprecated Calendar control</em> look like below.</p>
  
  <p><a href="https://i.stack.imgur.com/LXHzf.png" rel="noreferrer"><img src="https://i.stack.imgur.com/LXHzf.png" alt="enter image description here"></a></p>
  
  <p><strong>So what problem can I face if I include these in my applicaiton?</strong></p>
  
  <p>If you include them in your project and distribute them to your friends, neighbours, clients etc the application may or may not work depending on whether they have those ocx installed.</p>
  
  <p>And hence it is highly advisable <strong>NOT</strong> to use them in your project</p>
  
  <p><strong>What alternative(s) do I have?</strong></p>
  
  <p>This <a href="https://stackoverflow.com/questions/12012206/formatting-mm-dd-yyyy-dates-in-textbox-in-vba/12013961#12013961">calendar, using Userform and Worksheet</a>, was suggested earlier and is incredibly basic.</p>
  
  <p>When I saw the Windows 10 calendar which popped up when I clicked on the date and time from the system tray, I could not help but wonder if we can replicate that in VBA.</p>
  
  <p>This post is about how to create a calendar <em>widget</em> which is not dependant on any ocx or 32bit/64bit and can be freely distributed with your project.</p>
  
  <p>This is what the calendar looks like in Windows 10:</p>
  
  <p><a href="https://i.stack.imgur.com/e412s.png" rel="noreferrer"><img src="https://i.stack.imgur.com/e412s.png" alt="enter image description here"></a></p>
  
  <p>and this is how you interact with it:</p>
  
  <p><a href="https://i.stack.imgur.com/O4G2j.png" rel="noreferrer"><img src="https://i.stack.imgur.com/O4G2j.png" alt="enter image description here"></a></p>