Solved

EXCEL FORM DATE PICKER ERRORS

Posted on 2007-11-22
5
962 Views
Last Modified: 2013-12-25
Experts,

I have produced some vb script that involves some date pickers. Before i send the code to colleagues, i have been trying the code out with other users and have found that i am having sever problems with the 'DATE PICKER' control with other users. For example, the following code returns an error when other users have used it - it is part of the userform intiliastion:

save_date_button.Enabled = False
Date_Picker.CustomFormat = Chr(32)<========= error
Date_Picker.Enabled = False

When i commented this out on the other users machine - and then attempted to use the date picker - another error was thrown out on the date picker mousedown event:

Private Sub Date_Picker_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As stdole.OLE_XPOS_PIXELS, ByVal Y As stdole.OLE_YPOS_PIXELS)
Dim a As Boolean
a = X > (Date_Picker.Width - 285) 'a = true if mouse is over the grey DTPicker button
If a = False Then Exit Sub
If Button <> 1 Then Exit Sub 'allow only left mouse button
If Date_Picker.Format <> dtpLongDate Then Call MakeDtpLongDate<============= ERROR
End Sub

it is like other users are not formatted to use the date pickers - yet the versions of excel they are using are exactly the same! So confused, could anyone please tell me why this is happening?

Thanks

Simon
0
Comment
Question by:simondopickup
  • 3
  • 2
5 Comments
 
LVL 85

Expert Comment

by:Rory Archibald
ID: 20334240
The Date and Time Picker control is not a standard Excel control. If you have VB6 (or Visual Studio) installed on your machine that may be where you got it from, in which case you need to package it up with the workbook in an installation routine, assuming you have a redistributable version and licence to do so.
Regards,
Rory
PS I assume you are not talking about the Calendar control? (which comes with MSAccess)
0
 

Author Comment

by:simondopickup
ID: 20334259
So this is not something i can set or have installed as the workbook opens?
0
 
LVL 85

Expert Comment

by:Rory Archibald
ID: 20334320
You need to distribute the actual control as it physically does not exist on most computers - it's not just a question of setting a reference. You need to copy the control and register it on each machine. (one reason I never use Date Pickers or Calendar controls)
0
 

Author Comment

by:simondopickup
ID: 20334974
OKay well i have a worksheet that contains 4 date pickers at present. I am going to send this to to lots of colleagues in the states and i dont want the thing to be throwing out errors as soon as they compile it. What would you suggest?
0
 
LVL 85

Accepted Solution

by:
Rory Archibald earned 500 total points
ID: 20335234
Do you have a copy of VB which entitles you to distribute the control? If so, you will need to create an installation package that includes the .ocx file for the Date Time Picker and distribute that.
Alternatively, remove the controls and let them enter dates manually.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now