0

最終的に(StackOverflowの支援により)時間関数ごとにエントリを配置することができたとき、新しい問題が提示されました。

添付したテンプレートのルールに従わなくなりました。簡単な解決策を考えたので、大きな問題ではありませんが、うまくいきません。

以下の目的で関数を追加しました。

  1. 渡された文字列 -theSentence- を配列 -theWords()- に分割します。

  2. 文字列 -final- (do while ループは配列から文字列に各単語を一度に 1 つずつ追加します) の長さが 56 を超えるかどうかを調べます

  3. -final- の長さが 56 を超える場合は、次の単語を追加する前に vbnewline を文字列に追加します

  4. 元の文字列 -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
4

0 に答える 0