好的,当我终于能够解决(在 StackOverflow 的帮助下)按时间函数排列条目时,我遇到了一个新问题。
它不再遵循我附加到它的模板的规则。不是一个大问题,因为我想到了一个快速的解决方案,但它不起作用。
我在下面添加了一个功能,目的:
将传递给它的字符串 -theSentence- 拆分为数组 -theWords()-
找出字符串 -final- (执行 while 循环将数组中的每个单词一次添加到字符串一个)如果长度超过 56
如果 -final- 长度超过 56,则在添加下一个单词之前将 vbnewline 添加到字符串
将原始字符串 -theSentnce- 更改为等于创建的字符串 -final- 在大约 56 长度后应该有一个 vbnewline
....不工作需要朝着正确的方向推动可能是愚蠢的
Function chckLen(ByVal theSentence As String)
Dim theWords() As String
Dim final As String
Dim arrayCntr As Integer
Dim arrayAmount As Integer
Dim chcker As Integer
arrayCntr = 0
theWords = Split(theSentence)
arrayAmount = UBound(theWords)
chcker = 56
Do While arrayCntr <= arrayAmount
If Len(final + theWords(arrayCntr)) > chcker Then
final = final + vbNewLine
final = final + theWords(arrayCntr)
chcker = chcker + 56
Else
final = final + " " + theWords(arrayCntr)
End If
arrayCntr = arrayCntr + 1
Loop
theSentence = final
End Function