![](/file/18315/Y2K_Resource_Nov99.iso/webcon~1/usa/year2k/images/spacer.gif)
Microsoft Year 2000 Readiness Disclosure & Resource Center |
![](/file/18315/Y2K_Resource_Nov99.iso/webcon~1/usa/year2k/images/spacer.gif) |
![](/file/18315/Y2K_Resource_Nov99.iso/webcon~1/usa/year2k/images/spacer.gif) |
![](/file/18315/Y2K_Resource_Nov99.iso/webcon~1/usa/year2k/images/spacer.gif) | Visual Basic for Applications 5.0 (French) - 32-Bit Win
Product Summary |
Product: Visual Basic for Applications Version: 5.0 |
Category: Compliant Operating System: 32-Bit Win |
Language: French |
Release Date: 01 May 1997 |
Operational Range: |
- |
Can applications be built with this tool that adhere to the Microsoft Year 2000 Compliance Statement? Yes |
Prerequisites: |
None |
Product Dependencies: |
Windows 95, or Windows NT 3.51 with Service Pack 5 or greater, or Windows NT 4.0 (Service Pack 2+ recommended) |
Clock Dependencies: |
System Clock |
Last Updated: |
10 May 1999 | |
Product Details |
Visual Basic for Applications (VBA) 5.0 32-Bit Win
Can applications be built with this tool that adhere to the Microsoft Year 2000 Compliance Statement?
Yes, provided the developer relies on the built-in Date data type and built-in date handling functions, and that data passed by applications that use Visual Basic for Applications (VBA) use 4-digit years to represent dates.
Products that have shipped with Visual Basic for Applications 5.0, include but are not limited to, the following: Excel 97, Access 97, Word 97, PowerPoint 97, and Project 98.
Operational Range for Data: System Dependent
How the product runtime handles dates:
VBA stores dates internally as an 8-byte floating-point value that represents the number of days (whole and fractional) since midnight, December 30, 1899. The integer portion represents the number of whole days and the decimal portion represents the fraction of a day. For example May 22, 1997 at 3:00pm would be stored as 35572.625 since May 22, 1997 is 35,572 days after December 30, 1899 and 3:00pm is 625/1000 of one day. VBA is capable of storing dates from January 1, 100 to through December 31, 9999.
VBA includes numerous date manipulation functions, which are designed to accurately handle dates within VBAÆs operational range. These intrinsic functions for date handling include:
Now () |
CDate() |
CVDate() |
DateValue() |
Date() |
Date$() |
Format() |
DateAdd() |
DateDiff() |
DatePart() |
IsDate() |
Day() |
Month() |
Weekday() |
Year() |
Time() |
Dates and times returned by the Now(), Date(), and Time() functions are obtained from the operating system clock.
A date may be displayed in 2-digit-year format (by using the Visual Basic format function, for example) but the value is carried as a long 4-digit-year value.
When only given 2 digits for the year, the product interprets the first 2 digits of the year according to a rule described below.
Two-digit shortcut handling:
The first 2 digits are assumed according to a specific rule in cases where only 2 digits are supplied for the date. The general rule is:
- 2-digit dates between 00-29 are assumed to be 20XX.
- 2-digit dates between 30-99 are assumed to be 19XX.
These are the defaults that most users running Windows 95 and Windows NT4 experience. However, VBA uses OLE Automation for parsing dates and consequently, uses OLE AutomationÆs rules for handling years that have only 2 digits. With machines that have older versions of OLE Automation (prior to version 2.30.00.0000), they may assume the current century given a 2-digit year and with newer versions of OLE Automation, this 100-year window can be set through a control panel setting.
See the OLE Automation web site at: http://www.microsoft.com/technet/year2k/white/auto.htm to learn more about this behavior.
Recommended practices to develop year 2000 compliant applications:
To create year 2000 compliant applications developers should focus on three areas:
- How dates are passed into VBA functions
- How dates are manipulated within VBA functions
- How dates are returned or displayed by VBA functions
When passing date values into VBA functions developers should use the intrinsic Date data type. For example, the following function accepts a date value as input:
Function DaysInMonth(AnyDate As Date) As Integer
DaysInMonth = DateSerial(Year(AnyDate), Month(AnyDate) + 1, 1) - _
DateSerial(Year(AnyDate), Month(AnyDate), 1)
End Function
VBA will perform resolution routines on data being passed into the procedure and raise a runtime error if the value is not a date.
Furthermore, developers should make sure that if a user-entered value is passed into functions (either directly or though a custom user interface) that 4 digits represent the year portion of the date.
Regarding date manipulation within functions developers should ensure that only intrinsic VBA functions are used. The example above uses the DateSerial, Year, and Month functions to compute the number of dates in a month.
Finally when data is returned by a VBA function it should also be defined using the intrinsic Date data type.
Common development errors dealing with year 2000 date issues:
User-defined functions are a prime area of date handling errors. A poorly written function may lead to problems. Developers should follow the guidelines outlined in the previous section.
Dates that are stored as strings are particularly prone to producing unexpected results if the information is not input in an appropriate format. VBA will interpret a string as a date if, by rearranging the month/day/year order, a valid date can be found. For example, both 3/30/98 (March 30, 1998) and 87/3/1 (March 1, 187) are valid dates even though the month/day/year order has changed.
Manipulating dates using string functions should also be avoided since the dateÆs format (2- or 4-digit years) can affect the result.
In general, custom VBA routines should use the intrinsic Date data type when storing date values.
Testing guidelines and recommendations:
The MSDN on-line library includes information on developing Year 2000 compliant applications with Visual Studio and Visual Basic (see http://msdn.microsoft.com/library/techart/msdn_vs6y2k.htm). The guidelines described in this document apply equally to VBA as well as VB.
Users testing applications written in VBA should be especially careful to test the following areas:
- User-defined functions: Many applications contain user-defined functions written in Visual Basic for Applications to deal with dates in various ways. Many of these functions store date values as strings. Manipulating these values improperly can result in date handling errors that are outside of the scope of the testing that was done at Microsoft on the Year 2000 issue.
- The date usage error described above can cause problems if an error handling routine is meant to catch improperly entered dates. Since VBA rarely generates an error when a string date is used as an input, an error handling routine is unlikely to be called. In this case the proper programming technique would be to validate the data using code instead of relying on a runtime error to signal an improper date.
| |
Return to Search Screen
Legend of Symbols: |
* |
The product is compliant with recommended customer action. This indicates a prerequisite action is recommended which may include loading a software update or reading a document. |
# |
The product is compliant with acceptable deviations from Microsoft's standard of compliance. An acceptable deviation does not affect the core functionality, data integrity, stability, or reliability of the product. |
+ |
The product is compliant with pending Year 2000 software updates. Future maintenance actions will be recommended shortly. See Product Guide for further details. |
Note: Compliance ratings given for each product assume that all recommended actions have been taken. |
If after reviewing this information you have additional questions related to this product, click here.
YEAR 2000 READINESS DISCLOSURE
ALL COMMUNICATIONS OR CONVEYANCES OF INFORMATION TO YOU CONCERNING MICROSOFT AND THE YEAR 2000, INCLUDING BUT NOT LIMITED TO THIS DOCUMENT OR ANY OTHER PAST, PRESENT OR FUTURE INFORMATION REGARDING YEAR 2000 TESTING, ASSESSMENTS, READINESS, TIME TABLES, OBJECTIVES, OR OTHER (COLLECTIVELY THE "MICROSOFT YEAR 2000 STATEMENT"), ARE PROVIDED AS A "YEAR 2000 READINESS DISCLOSURE" (AS DEFINED BY THE YEAR 2000 INFORMATION AND READINESS DISCLOSURE ACT) AND CAN BE FOUND AT MICROSOFT'S YEAR 2000 WEBSITE LOCATED AT http://www.microsoft.com/year2000/ (the "Y2K WEBSITE"). EACH MICROSOFT YEAR 2000 STATEMENT IS PROVIDED PURSUANT TO THE TERMS HEREOF, THE TERMS OF THE Y2K WEBSITE, AND THE YEAR 2000 INFORMATION AND READINESS DISCLOSURE ACT FOR THE SOLE PURPOSE OF ASSISTING THE PLANNING FOR THE TRANSITION TO THE YEAR 2000. EACH MICROSOFT YEAR 2000 STATEMENT CONTAINS INFORMATION CURRENTLY AVAILABLE AND IS UPDATED REGULARLY AND SUBJECT TO CHANGE. MICROSOFT THEREFORE RECOMMENDS THAT YOU CHECK THE Y2K WEBSITE REGULARLY FOR ANY CHANGES TO ANY MICROSOFT YEAR 2000 STATEMENT. EACH MICROSOFT YEAR 2000 STATEMENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. CONSEQUENTLY, MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. MOREOVER, MICROSOFT DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OR THE RESULTS OF THE USE OF ANY MICROSOFT YEAR 2000 STATEMENT IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY, OR OTHERWISE. NO ORAL OR WRITTEN INFORMATION OR ADVICE GIVEN BY MICROSOFT OR ITS AUTHORIZED REPRESENTATIVES SHALL CREATE A WARRANTY OR IN ANY WAY DECREASE THE SCOPE OF THIS WARRANTY DISCLAIMER. IN NO EVENT SHALL MICROSOFT OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER REGARDING ANY MICROSOFT YEAR 2000 STATEMENT INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS, PUNITIVE OR SPECIAL DAMAGES, EVEN IF MICROSOFT OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES, SO THE FOREGOING LIMITATION MAY NOT APPLY TO YOU. THE INFORMATION CONTAINED IN EACH MICROSOFT YEAR 2000 STATEMENT IS FOUND AT THE Y2K WEBSITE AND IS INTENDED TO BE READ IN CONJUNCTION WITH OTHER INFORMATION LOCATED AT THE Y2K WEBSITE, INCLUDING BUT NOT LIMITED TO MICROSOFT'S YEAR 2000 COMPLIANCE STATEMENT, THE DESCRIPTION OF THE CATEGORIES OF COMPLIANCE INTO WHICH MICROSOFT HAS CLASSIFIED ITS PRODUCTS IN ITS YEAR 2000 PRODUCT GUIDE, AND THE MICROSOFT YEAR 2000 TEST CRITERIA.
ANY MICROSOFT YEAR 2000 STATEMENTS MADE TO YOU IN THE COURSE OF PROVIDING YEAR 2000 RELATED UPDATES, YEAR 2000 DIAGNOSTIC TOOLS, OR REMEDIATION SERVICES (IF ANY) ARE SUBJECT TO THE YEAR 2000 INFORMATION AND READINESS DISCLOSURE ACT (112 STAT. 2386). IN CASE OF A DISPUTE, THIS ACT MAY REDUCE YOUR LEGAL RIGHTS REGARDING THE USE OF ANY SUCH STATEMENTS, UNLESS OTHERWISE SPECIFIED BY YOUR CONTRACT OR TARIFF.
|