Mrrrr's Forum (VIEW ONLY)
Un forum care ofera solutii pentru unele probleme legate in general de PC. Pe langa solutii, aici puteti gasi si alte lucruri interesante // A forum that offers solutions to some PC related issues. Besides these, here you can find more interesting stuff.
Lista Forumurilor Pe Tematici
Mrrrr's Forum (VIEW ONLY) | Reguli | Inregistrare | Login

POZE MRRRR'S FORUM (VIEW ONLY)

Nu sunteti logat.
Nou pe simpatie:
beatrice17 din Bucuresti
Femeie
24 ani
Bucuresti
cauta Barbat
24 - 80 ani
Mrrrr's Forum (VIEW ONLY) / Tutoriale si Ghiduri Utile // Tutorials and useful guides / [WORD] Override the 255 Character Limit for Text Field Moderat de TRaP, TonyTzu
Autor
Mesaj Pagini: 1
TRaP
Moderator

Inregistrat: acum 6 ani
Postari: 739
Even though the Properties of the Text Field say "Unlimited" when it comes to "Maximum length", whatever I do I hit my head on a 255 character limit.

Apparently this limit can be done only with VBA (why unlimited then? anyway...).

Adapted the code from Source a bit, since it was inserting my text outside the Text Field (just made it go left 1 character, right before the end).


Sub WriteLongTextToFormField()
  Dim ffld As Word.FormField
  Dim doc As Word.Document
  Dim rng As Word.Range
  Dim s1 As String, s2 As String

  Set doc = ActiveDocument
  'Get the long text
  Set rng = doc.Range(doc.Paragraphs(1).Range.Start, doc.Paragraphs(2).Range.End)
  'Split off a bit to go into FormField.Result
  s1 = rng.Words(1)
  rng.MoveStart wdWord, 1
  'The rest of the long text, to be assigned to Selection.Text
  s2 = rng.Text

  Set ffld = doc.FormFields("txt123") ' Field Settings - Bookmark
  ffld.Result = s1
  ffld.Select
  Selection.MoveRight wdCharacter, 1
  Selection.MoveLeft wdCharacter, 1 ' Moving back to step back into the text field
  Selection.Text = s2
End Sub


Source:


pus acum 2 luni
   
Pagini: 1  

Mergi la