Wednesday, August 30, 2006

Excel

The Excel utility library is available as an add-in file with an extension of XLA. Store the file in an appropriate folder, then from Excel choose Tools, Add-Ins, Browse, locate the file, make sure it is checked ON, confirm and use.

How use?

From an empty cell, start a formula with the "equals" sign, use the function-picker ("fx" button), Function category "User defined", and scroll to "strDateTime".

Confirm out of there and observe he dynamic date and time, formatted as a 14-character string, in your cell. OK, Big deal, you have the Now() function in Excel.

Try the strAlphaDigitsOnly function; point it to a cell containing a mixed bag of characters:

Try obtaining your run-time parameters from an INI file:

Knock, as we say, yourself our!

You can now use Excel to test if a file is a Word Perfect DOS 5.1 file!

Wednesday, August 23, 2006

Two new releases

I have added links to my Downloads page.

You can now download the latest revision of the stand-alone files that contain my Microsoft Word utility library and Microsoft Excel utility library.

Tuesday, August 15, 2006

Constants

Good programming practices suggest the use of compile-time constants rather than literal strings.

Instead of writing:
strWorkFile = strWorkFile & ".TXT"

We write:

strWorkFile = strWorkFile & strcExtentTxt


And include a declaration:

Public Const strcExtentTxt As String = ".TXT"


This may seem like extra work - replacing one line of code with two lines, but think again.

By placing the character string in a constant and using the identifier for reference, we are assured of a common and consistent definition of the string, and have avoided the costly maintenance problem of a typo in one of perhaps twenty occurrences of the string throughout or program.

As well, we can convert the compile-time constant to an installation or a run-time constant with a small modification, and will not be required to search through the program looking for occurrences of the literal string.

You can draw on many years of established consistency by using the string constants defined in UW.DOT.

Use Intellisense to draw out identifiers that are prefaced with "strc" (as in "str"ing "c"onstant)
Sub test()
MsgBox UW.strcAlpha
MsgBox UW.strcAlphaDigits
MsgBox UW.StrcDigits
MsgBox UW.strcDriveSeparator
End Sub