How to TRIM() cr/lf?

What about TRIM() for removing white space from strings!
Although it is a really handy BUG-ELIMINATOR for *IF* ever a user pastes rich text into your (MS-Access) application, STILL this attachment demonstrates that TRIM only works on outer spaces, not other white space characters like ASCII characters 9, 10, 12, 13. (vbTab, vbLf, Formfeed, vbCr)

' Save this in a VBS file on your desktop for a VISUAL DEMO comparing three string cleaning functions below
Dim someOtherString, someOtherString1, someOtherString2, someOtherString3
someOtherString1 = vbCrLf & vbTab & "Hi Mom!" & int(rnd(100)*5) & vbTab & vbCrLf
someOtherString2 = vbCrLf & vbTab & "Hi Mom!" & int(rnd(100)*5) & vbTab & vbCrLf
someOtherString3 = vbCrLf & vbTab & "Hi Mom!" & int(rnd(100)*5) & vbTab & vbCrLf
msgbox chr(34) & trim(someOtherString1) & chr(34),,"Trim"
msgbox chr(34) & nibble(someOtherString2) & chr(34),,"Nibble"
msgbox chr(34) & chomp(someOtherString3) & chr(34),,"Chomp"
' --------------------
Function chomp(somestring)
if len(somestring) >= 1 then
while (asc(right(somestring,1)) <= 13 )
somestring = left(somestring, len(somestring)-1)
end if
chomp = somestring
End Function
' --------------------
Function nibble(somestring)
if len(somestring) >= 1 then
while (asc(left(somestring,1)) <= 13 )
somestring = right(somestring, len(somestring)-1)
end if
nibble = somestring
End Function


Word: Hidden Fields Risk ?

When you Share or modify Word files - you can get OTHER PEOPLE's  names, IDs and personal information!  WORSE yet, you can GIVE others your own personal or proprietary info! How to Find these fields?  How to replace or purge them?

The macro at bottom of this page performs a checkup of common fields.

The top of the page shows you screenshots of how to find these fields in WinWord (Word for Windows®) via (a) shortcut "Alt-I-F" (b) Menu Tab "Insert" and (c) Macro Message box

(a) shortcut Alt-I-F
(a) shortcut Alt-I-F
(b) Menu Tab ''Insert''
(b) Menu Tab ''Insert''
c) Macro WordDocProperties Message box
c) Macro WordDocProperties Message box

Sub WordDocProperties()
Dim strTemp, strProp, strNameList As String
Dim thisRange   'strNameList used to bypass error thrown by at least one of the named properties
strNameList = "title,subject,author,last author,company,manager,Last Save time,Creation Date,Comments,Total Editing Time" 
'short list for demo. See menu [screenshot (b) above] in Word® for full list
xyz = Split(strNameList, ",")
Set thisRange = ActiveDocument.Content
 thisRange.Collapse Direction:=wdCollapseEnd ' wdCollapseStart is default per
For Each Prop In ActiveDocument.BuiltInDocumentProperties '.CustomDocumentProperties BuiltInDocumentProperties
  With thisRange
    On Error Resume Next
    strProp = Prop.Name 'here, at least one property throws an error not trapped by 'on error'
    If Err.Number Then strProp = " n/a " ' this never happens: see above
' strTemp = strTemp & vbCrLf & Prop.Name 'for deriving full namelist
    If IsNumeric(findElementinArray(Prop.Name, xyz)) Then strTemp = strTemp & vbCrLf & Prop.Name & " = " & Prop.Value
    On Error GoTo 0
 End With
 MsgBox strTemp, , "Sub WordDocProperties"
End Sub
Function findElementinArray(someString, someArray) 'returns index of found item, else "" if not found
Dim kounter, i, j, k As Integer
findElementinArray = ""
    For k = LBound(someArray) To UBound(someArray)
        If UCase(someString) = UCase(someArray(k)) Then
            findElementinArray = k
            Exit For
        End If
    Next k
End Function