Procedure Name | Type | Description |
(Declarations) | Declarations | Declarations and private variables for the modYear2000 module. |
IsOLELibNewer | Procedure | Determine if the installed OLE Automation library (OLEAUT32.DLL) has the sliding window algorithm in place. See the notes for the modYear2000 module for information on the sliding window algorithm. |
GetResourceVersion | Procedure | Get file version information. This private procedure supports other members of the module. |
SafeCenturyVBA | Procedure | Get the passed date with the century modified as determined by the specified pivot year. If the last two digits of the supplied date are less than or equal to the intPivot value, the 21st century is used. Otherwise, the 20th century is used. Note that any century information supplied in the varDateIn parameter is thrown away. This is because by the time a date gets to this procedure, VBA/VB6 has most likely already assumed the century and the date is therefore suspect. See the notes for the modYear2000 module for information on the sliding window algorithm. |
SetShortDateFormat | Procedure | Set the Windows Control Panel (or WIN.INI) definition for short date format. Note that setting Control Panel Short Date format to four digit years is not a robust solution to the Year 2000 problem--it is merely a stop-gap workaround. For details, see the notes for the modYear2000 module. |
ShowCurrentShortDate | Procedure | Get the current Windows Control Panel (or WIN.INI) short date setting. Note that setting Control Panel Short Date format to four digit years is not a robust solution to the Year 2000 problem--it is merely a stop-gap workaround. For details, see the notes for the modYear2000 module. |
WinINIGetSetting | Procedure | Get a string value from the WIN.INI file. This is a private helper procedure that supports other members of the module. |
WinINIWriteSetting | Procedure | Writes the specified value to WIN.INI. This is a private helper procedure that supports other members of the module. |
' Example of modYear2000 ' ' To use this example, create a new module and paste this code into it. ' Then run the procedure by putting the cursor in the procedure and pressing: ' F5 to run it, or ' F8 to step through it line-by-line (see the Debug menu for more options) Private Sub Example_modYear2000() ' Comments: Example of using the modYear2000 module for four digit years in VBA and VB6. Dim fSlidingWindow As Boolean Dim strText As String ' Determine if the installed OLE Automation library (OLEAUT32.DLL) is the newer version which supports the sliding window algorithm. fSlidingWindow = IsOLELibNewer() strText = "Your system is " If Not fSlidingWindow Then strText = strText & " not " End If strText = strText & "using the newer version of the OLE automation library which supports the sliding window algorithm." Debug.Print strText ' Next, see what the control panel's setting for short dates is Debug.Print "Your Short Date setting in Control Panel is: " & ShowCurrentShortDate() ' Set the short date format to show the full four digits of the year (Uncomment the next two lines to make this work.) ' strText = SetShortDateFormat("mm/dd/yyyy") ' Debug.Print "New short date is: " & strText ' Take a date that only has a suspected century and return the full date with a four-digit year according to the rules that ' our procedure defines. Debug.Print "The safe version of 01/12/22 with a pivot century of 29 is: " & Format$(SafeCenturyVBA(#1/12/2022#, 29), "mm/dd/yyyy") Debug.Print "The safe version of 01/12/50 with a pivot century of 29 is: " & Format$(SafeCenturyVBA(#1/12/1950#, 29), "mm/dd/yyyy") End Sub
The source code in Total Visual Sourcebook includes modules and classes for Microsoft Access, Visual Basic 6 (VB6), and Visual Basic for Applications (VBA) developers. Easily add this professionally written, tested, and documented royalty-free code into your applications to simplify your application development efforts.
Total Visual SourceBook is written for the needs of a developer using a source code library covering the many challenges you face. Countless developers over the years have told us they learned some or much of their development skills and tricks from our code. You can too!
Supports Access/Office 2016, 2013, 2010 and 2007, and Visual Basic 6.0!
"The code is exactly how I would like to write code and the algorithms used are very efficient and well-documented."
Van T. Dinh, Microsoft MVP