Date and Time Picker on UserForm

randolphoralph

Board Regular
Joined
Dec 24, 2008
Messages
126
I am trying to use the Date and Time Picker 6.0 and I have add it to the userform and named it DateofContact.

When I play the userform I get a error stating:

"Compile Error-Method or Data member not found"

Below I have added the code and it shows in red where the problem is.

Code:
Private Sub UserForm_Activate()
     
    PSA.Text = Cells(lCurrentRow, 2).Value
    cboTypeofContact.Text = Cells(lCurrentRow, 3).Value
    DateofContact.[COLOR=red]Text[/COLOR] = Cells(lCurrentRow, 4).Value
    TimeofContact.Text = Cells(lCurrentRow, 5).Value
End Sub
I am not sure what to put in its place.
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Does anyone know how to add Date and Time Picker on the fly in VBA code? I found out that not all the users have the Date and Time Picker.
 
Upvote 0
Try;
Code:
Me.DTPicker1.Value = DateSerial(2008, 2, 2)
abd refer this...
Code:
MsgBox TypeName(Me.DTPicker1.Value)
 
Upvote 0
I found out that the majority of the users do not have the date and time picker. Due to security the users are unable to install add-ins or any additional controls to the vb toolbox.

In order to work around this I need to add the date/time picker into the project code.

Does anyone know of a open source date/time picker? I have looked around and everyone that I find has the source code protected.
 
Last edited:
Upvote 0
If your users don't have the Date/time picker and can't install it, then you can't use it, whether at design time or at runtime.
Why not just have controls for day, month and year and validate the date as it is entered - it's a lot easier.
 
Upvote 0
Rory,

I am not looking to use the Date/time picker but I am looking for something similar that can be written directly into the VBA project and would not require a install.

What did you mean by having controls for day, month and year and validate the date as it is entered?

-Randolph
 
Upvote 0
I meant simply adding say a textbox (or combo) for the day, a combo for the month and a textbox for the year. You can then concatenate and validate the date on completion of the three controls.
 
Upvote 0
I am curious though on the subject of activating the date picker on machines that use the macro. As vba writers we know to right click the toolbox and check the appropriate box put that is far beyond the level of those who will be using this macro when distributed. Any ideas of how to turn on that functionality before the Userform opens?
 
Upvote 0
If they have the control, your code will work. If they don't, it won't and they cannot simply add it.
 
Upvote 0

Forum statistics

Threads
1,215,926
Messages
6,127,731
Members
449,401
Latest member
TTXS

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top