Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2304
  • Last Modified:

Excel VBA DTPicker

Hello Experts - How to set DTPicker controls such way that the output value will be default current time and date now()  unless user selects thier own date and time? I just need to pick up the selection and use in my code. Couldn't find a straight answer....
cheers, v
0
NewToVBA
Asked:
NewToVBA
  • 4
  • 3
1 Solution
 
jppintoCommented:
DTPicker.Value = Date()
0
 
SiddharthRoutCommented:
0
 
NewToVBAAuthor Commented:
Hi Sid, I tested it and found issues.
The output I with the code is with extended full format, e.g., Tuesday, April ,  no matter what format I define in
the object properties or the code itself, as you suggested. The form behaves pretty erratically, cannot define relation
between the object settings vs those in the code.  Any examples of how to mange that will be greatly appreciated.

Cheers V
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
SiddharthRoutCommented:
Show me the exact code that you are using?

Sid
0
 
NewToVBAAuthor Commented:
Hi Sid; I attached a test file pretty much showing what I am after. The objective is to display in the box date and time in format "mm/dd/yy hh:mm". What I get is the extended format, while the output, i.e., DTPicker.value is in the fine. I played with the object settings trying to stay within reasonable range of options, like "mmm/dd/yy", ddd/mm/yy", "yy/mm/dd",etc.,  and got some very strange results, e.g., "45/53/11" etc. I expected to control the format as Excel does anywhere else.

Many thanks, V DTPicker-Test.xls
0
 
SiddharthRoutCommented:
That is because DTPicker picks up the Long Date Format from the "Regional setting"

If you click on Control Panel~~> Regional Settings~~> Customize settings~~>Date Tab (Under Long Date), you will see that the formay is MMMM dd, yyyy and hence you are getting that format :)

For testing purpose, if you replace it with "mm/dd/yy", you will get the desired results.

Sid
0
 
NewToVBAAuthor Commented:
Many thanks, Sid!

Bill Gates -  listen to Sid, and fix those stupid MS inconsistences!!
0
 
SiddharthRoutCommented:
Whoa :)

Bill doesn't need my advice :) I am sure this has already been highlighted to the MS Team. Please note that DTpicker is a vb6 control and vb6 is now dying :( (I love vb6) so I doubt if anything can be or will be done about it.

Sid
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now