I'm trying to label a text field in up to 3 lines with 28 character spacing on each line. I've written the following code and it works in excel but when I put it into ArcView, it labels anything that is 28 characters or less but not anything over. Was wondering if someone could see where I've gone wrong. (Comments is the field I'm labeling.)
Function FindLabel([Comments])
Dim lbl
Dim position
Dim RowLength
RowLength = 28
If Len([Comments]) > RowLength Then
position = RowLength - 1
lbl = Comments
Do
If position Mod RowLength = 0 Then
spacePos = InStrRev(lbl, " ", position)
lbl = Left(lbl, spacePos) & Replace(lbl, " ", vbnewline, spacePos, 1)
End If
position = position + 1
Loop Until position >= Len([Comments])
Else
lbl = lbl & [Comments]
End If
FindLabel = lbl
End Function
Thanks
Function FindLabel([Comments])
Dim lbl
Dim position
Dim RowLength
RowLength = 28
If Len([Comments]) > RowLength Then
position = RowLength - 1
lbl = Comments
Do
If position Mod RowLength = 0 Then
spacePos = InStrRev(lbl, " ", position)
lbl = Left(lbl, spacePos) & Replace(lbl, " ", vbnewline, spacePos, 1)
End If
position = position + 1
Loop Until position >= Len([Comments])
Else
lbl = lbl & [Comments]
End If
FindLabel = lbl
End Function
Thanks