Public Function StringCells(FlexGrid As msflexgrid, _
ColumnNo As Long, Delimiter As String, TrimAll As Boolean) As String Dim RowLoop As Long Dim FirstBox As Long Dim LastBox As Long Dim tempString As String If FlexGrid.RowSel > FlexGrid.Row Then FirstBox = FlexGrid.Row LastBox = FlexGrid.RowSel Else FirstBox = FlexGrid.RowSel LastBox = FlexGrid.Row End If For RowLoop = FirstBox To LastBox If tempString = "" Then If TrimAll = True Then tempString = Trim$(FlexGrid.TextMatrix(RowLoop, ColumnNo)) Else tempString = FlexGrid.TextMatrix(RowLoop, ColumnNo) End If Else If TrimAll = True Then tempString = tempString & Delimiter & _ Trim$(FlexGrid.TextMatrix(RowLoop, ColumnNo)) Else tempString = tempString & Delimiter & FlexGrid.TextMatrix(RowLoop, ColumnNo) End If End If Next RowLoop StringCells = tempString End Function |