Copier textbox de plus de 255 caractères dans une cellule
2 réponses
lydya
Bonjour,
J'essaie de copier par macro le contenu d'un textbox (BO formulaires) dans
une cellule et je ne récupère que 255 caractères au plus.
Comment puis-je récupérer tout le contenu du textbox dans ma cellule quand
il fait plus de 255 caractères?
Merci par avance de votre aide.
Sample Visual Basic Procedures Sub TextBox_To_TextBox()
' Dimension the variables. Dim x As Integer Dim txtBox1 As TextBox, txtBox2 As TextBox Dim theText As String
' Set txtBox1 and txtBox2 equal to the active sheet's TextBox ' objects. Replace the ordinal number with your TextBox names ' in quotes. For example: ActiveSheet.DrawingObjects("Text 1") Set txtBox1 = ActiveSheet.DrawingObjects(1) Set txtBox2 = ActiveSheet.DrawingObjects(2)
' Create a For-Next construct that loops until there is no more ' text in txtBox1. For x = 1 To txtBox1.Characters.Count Step 250
' Place the first text box text into a variable called theText. theText = txtBox1.Characters(start:=x, Length:%0).Text
' Place the value of theText variable into second text box. txtBox2.Characters(start:=x, Length:%0).Text = theText
Next End Sub
The following Sub procedure copies the values from a range of cells that you specify into a text box on the active sheet.
Sub Cell_Text_To_TextBox()
' Dimension the variables. Dim txtBox1 As TextBox Dim theRange As Range, cell As Range Dim startPos As Integer
' Set txtBox1 equal to the active sheet's TextBox object. You can ' replace the ordinal number with your text box name in quotes. ' For example: ActiveSheet.DrawingObjects("Text 1") Set txtBox1 = ActiveSheet.DrawingObjects(1)
' Set a range on the active sheet equal to the range object text ' that you are interested in copying to the text box. Set theRange = ActiveSheet.Range("A1:A10")
'Set the starting position for the text. startPos = 1
' Create a For-Each construct to loop through the cells in the range. For Each cell In theRange
' Populate the textbox with the cell values using the Characters ' method. ' Note: Chr(10) can be used to add a new line in the textbox for ' each cell. txtBox1.Characters(start:=startPos, _ length:=Len(cell.Value)).Text = cell.Value & Chr(10)
' Update the startPos variable to keep track of where the next ' string of text will begin in the textbox. startPos = startPos + Len(cell.Value) + 1
Next cell End Sub
Salutations!
"lydya" a écrit dans le message de news: % Bonjour,
J'essaie de copier par macro le contenu d'un textbox (BO formulaires) dans une cellule et je ne récupère que 255 caractères au plus. Comment puis-je récupérer tout le contenu du textbox dans ma cellule quand il fait plus de 255 caractères? Merci par avance de votre aide.
Sample Visual Basic Procedures
Sub TextBox_To_TextBox()
' Dimension the variables.
Dim x As Integer
Dim txtBox1 As TextBox, txtBox2 As TextBox
Dim theText As String
' Set txtBox1 and txtBox2 equal to the active sheet's TextBox
' objects. Replace the ordinal number with your TextBox names
' in quotes. For example: ActiveSheet.DrawingObjects("Text 1")
Set txtBox1 = ActiveSheet.DrawingObjects(1)
Set txtBox2 = ActiveSheet.DrawingObjects(2)
' Create a For-Next construct that loops until there is no more
' text in txtBox1.
For x = 1 To txtBox1.Characters.Count Step 250
' Place the first text box text into a variable called theText.
theText = txtBox1.Characters(start:=x, Length:%0).Text
' Place the value of theText variable into second text box.
txtBox2.Characters(start:=x, Length:%0).Text = theText
Next
End Sub
The following Sub procedure copies the values from a range of cells that you specify into a text box on the active
sheet.
Sub Cell_Text_To_TextBox()
' Dimension the variables.
Dim txtBox1 As TextBox
Dim theRange As Range, cell As Range
Dim startPos As Integer
' Set txtBox1 equal to the active sheet's TextBox object. You can
' replace the ordinal number with your text box name in quotes.
' For example: ActiveSheet.DrawingObjects("Text 1")
Set txtBox1 = ActiveSheet.DrawingObjects(1)
' Set a range on the active sheet equal to the range object text
' that you are interested in copying to the text box.
Set theRange = ActiveSheet.Range("A1:A10")
'Set the starting position for the text.
startPos = 1
' Create a For-Each construct to loop through the cells in the range.
For Each cell In theRange
' Populate the textbox with the cell values using the Characters
' method.
' Note: Chr(10) can be used to add a new line in the textbox for
' each cell.
txtBox1.Characters(start:=startPos, _
length:=Len(cell.Value)).Text = cell.Value & Chr(10)
' Update the startPos variable to keep track of where the next
' string of text will begin in the textbox.
startPos = startPos + Len(cell.Value) + 1
Next cell
End Sub
Salutations!
"lydya" <prenomfirstname@libertysurf.fr> a écrit dans le message de news: %23sRBLkGJFHA.1176@TK2MSFTNGP12.phx.gbl...
Bonjour,
J'essaie de copier par macro le contenu d'un textbox (BO formulaires) dans
une cellule et je ne récupère que 255 caractères au plus.
Comment puis-je récupérer tout le contenu du textbox dans ma cellule quand
il fait plus de 255 caractères?
Merci par avance de votre aide.
Sample Visual Basic Procedures Sub TextBox_To_TextBox()
' Dimension the variables. Dim x As Integer Dim txtBox1 As TextBox, txtBox2 As TextBox Dim theText As String
' Set txtBox1 and txtBox2 equal to the active sheet's TextBox ' objects. Replace the ordinal number with your TextBox names ' in quotes. For example: ActiveSheet.DrawingObjects("Text 1") Set txtBox1 = ActiveSheet.DrawingObjects(1) Set txtBox2 = ActiveSheet.DrawingObjects(2)
' Create a For-Next construct that loops until there is no more ' text in txtBox1. For x = 1 To txtBox1.Characters.Count Step 250
' Place the first text box text into a variable called theText. theText = txtBox1.Characters(start:=x, Length:%0).Text
' Place the value of theText variable into second text box. txtBox2.Characters(start:=x, Length:%0).Text = theText
Next End Sub
The following Sub procedure copies the values from a range of cells that you specify into a text box on the active sheet.
Sub Cell_Text_To_TextBox()
' Dimension the variables. Dim txtBox1 As TextBox Dim theRange As Range, cell As Range Dim startPos As Integer
' Set txtBox1 equal to the active sheet's TextBox object. You can ' replace the ordinal number with your text box name in quotes. ' For example: ActiveSheet.DrawingObjects("Text 1") Set txtBox1 = ActiveSheet.DrawingObjects(1)
' Set a range on the active sheet equal to the range object text ' that you are interested in copying to the text box. Set theRange = ActiveSheet.Range("A1:A10")
'Set the starting position for the text. startPos = 1
' Create a For-Each construct to loop through the cells in the range. For Each cell In theRange
' Populate the textbox with the cell values using the Characters ' method. ' Note: Chr(10) can be used to add a new line in the textbox for ' each cell. txtBox1.Characters(start:=startPos, _ length:=Len(cell.Value)).Text = cell.Value & Chr(10)
' Update the startPos variable to keep track of where the next ' string of text will begin in the textbox. startPos = startPos + Len(cell.Value) + 1
Next cell End Sub
Salutations!
"lydya" a écrit dans le message de news: % Bonjour,
J'essaie de copier par macro le contenu d'un textbox (BO formulaires) dans une cellule et je ne récupère que 255 caractères au plus. Comment puis-je récupérer tout le contenu du textbox dans ma cellule quand il fait plus de 255 caractères? Merci par avance de votre aide.
Sample Visual Basic Procedures Sub TextBox_To_TextBox()
' Dimension the variables. Dim x As Integer Dim txtBox1 As TextBox, txtBox2 As TextBox Dim theText As String
' Set txtBox1 and txtBox2 equal to the active sheet's TextBox ' objects. Replace the ordinal number with your TextBox names ' in quotes. For example: ActiveSheet.DrawingObjects("Text 1") Set txtBox1 = ActiveSheet.DrawingObjects(1) Set txtBox2 = ActiveSheet.DrawingObjects(2)
' Create a For-Next construct that loops until there is no more ' text in txtBox1. For x = 1 To txtBox1.Characters.Count Step 250
' Place the first text box text into a variable called theText. theText = txtBox1.Characters(start:=x, Length:%0).Text
' Place the value of theText variable into second text box. txtBox2.Characters(start:=x, Length:%0).Text = theText
Next End Sub
The following Sub procedure copies the values from a range of cells that you specify into a text box on the active
sheet.
Sub Cell_Text_To_TextBox()
' Dimension the variables. Dim txtBox1 As TextBox Dim theRange As Range, cell As Range Dim startPos As Integer
' Set txtBox1 equal to the active sheet's TextBox object. You can ' replace the ordinal number with your text box name in quotes. ' For example: ActiveSheet.DrawingObjects("Text 1") Set txtBox1 = ActiveSheet.DrawingObjects(1)
' Set a range on the active sheet equal to the range object text ' that you are interested in copying to the text box. Set theRange = ActiveSheet.Range("A1:A10")
'Set the starting position for the text. startPos = 1
' Create a For-Each construct to loop through the cells in the range.
For Each cell In theRange
' Populate the textbox with the cell values using the Characters ' method. ' Note: Chr(10) can be used to add a new line in the textbox for ' each cell. txtBox1.Characters(start:=startPos, _ length:=Len(cell.Value)).Text = cell.Value & Chr(10)
' Update the startPos variable to keep track of where the next ' string of text will begin in the textbox. startPos = startPos + Len(cell.Value) + 1
Next cell End Sub
Salutations!
"lydya" a écrit dans le message de news: %
Bonjour,
J'essaie de copier par macro le contenu d'un textbox (BO formulaires) dans une cellule et je ne récupère que 255 caractères au plus. Comment puis-je récupérer tout le contenu du textbox dans ma cellule quand il fait plus de 255 caractères? Merci par avance de votre aide.
Lydya
Merci Denis,
Cela fonctionne bien.
Bonne nuit!
Lydya
"MichDenis" <michdenis@hotmail.com> a écrit dans le message de
news:eRHBssGJFHA.2524@TK2MSFTNGP10.phx.gbl...
Sample Visual Basic Procedures
Sub TextBox_To_TextBox()
' Dimension the variables.
Dim x As Integer
Dim txtBox1 As TextBox, txtBox2 As TextBox
Dim theText As String
' Set txtBox1 and txtBox2 equal to the active sheet's TextBox
' objects. Replace the ordinal number with your TextBox names
' in quotes. For example: ActiveSheet.DrawingObjects("Text 1")
Set txtBox1 = ActiveSheet.DrawingObjects(1)
Set txtBox2 = ActiveSheet.DrawingObjects(2)
' Create a For-Next construct that loops until there is no more
' text in txtBox1.
For x = 1 To txtBox1.Characters.Count Step 250
' Place the first text box text into a variable called theText.
theText = txtBox1.Characters(start:=x, Length:%0).Text
' Place the value of theText variable into second text box.
txtBox2.Characters(start:=x, Length:%0).Text = theText
Next
End Sub
The following Sub procedure copies the values from a range of cells that
you specify into a text box on the active
sheet.
Sub Cell_Text_To_TextBox()
' Dimension the variables.
Dim txtBox1 As TextBox
Dim theRange As Range, cell As Range
Dim startPos As Integer
' Set txtBox1 equal to the active sheet's TextBox object. You can
' replace the ordinal number with your text box name in quotes.
' For example: ActiveSheet.DrawingObjects("Text 1")
Set txtBox1 = ActiveSheet.DrawingObjects(1)
' Set a range on the active sheet equal to the range object text
' that you are interested in copying to the text box.
Set theRange = ActiveSheet.Range("A1:A10")
'Set the starting position for the text.
startPos = 1
' Create a For-Each construct to loop through the cells in the
range.
For Each cell In theRange
' Populate the textbox with the cell values using the Characters
' method.
' Note: Chr(10) can be used to add a new line in the textbox for
' each cell.
txtBox1.Characters(start:=startPos, _
length:=Len(cell.Value)).Text = cell.Value & Chr(10)
' Update the startPos variable to keep track of where the next
' string of text will begin in the textbox.
startPos = startPos + Len(cell.Value) + 1
Next cell
End Sub
Salutations!
"lydya" <prenomfirstname@libertysurf.fr> a écrit dans le message de news:
%23sRBLkGJFHA.1176@TK2MSFTNGP12.phx.gbl...
Bonjour,
J'essaie de copier par macro le contenu d'un textbox (BO formulaires) dans
une cellule et je ne récupère que 255 caractères au plus.
Comment puis-je récupérer tout le contenu du textbox dans ma cellule quand
il fait plus de 255 caractères?
Merci par avance de votre aide.
Sample Visual Basic Procedures Sub TextBox_To_TextBox()
' Dimension the variables. Dim x As Integer Dim txtBox1 As TextBox, txtBox2 As TextBox Dim theText As String
' Set txtBox1 and txtBox2 equal to the active sheet's TextBox ' objects. Replace the ordinal number with your TextBox names ' in quotes. For example: ActiveSheet.DrawingObjects("Text 1") Set txtBox1 = ActiveSheet.DrawingObjects(1) Set txtBox2 = ActiveSheet.DrawingObjects(2)
' Create a For-Next construct that loops until there is no more ' text in txtBox1. For x = 1 To txtBox1.Characters.Count Step 250
' Place the first text box text into a variable called theText. theText = txtBox1.Characters(start:=x, Length:%0).Text
' Place the value of theText variable into second text box. txtBox2.Characters(start:=x, Length:%0).Text = theText
Next End Sub
The following Sub procedure copies the values from a range of cells that you specify into a text box on the active
sheet.
Sub Cell_Text_To_TextBox()
' Dimension the variables. Dim txtBox1 As TextBox Dim theRange As Range, cell As Range Dim startPos As Integer
' Set txtBox1 equal to the active sheet's TextBox object. You can ' replace the ordinal number with your text box name in quotes. ' For example: ActiveSheet.DrawingObjects("Text 1") Set txtBox1 = ActiveSheet.DrawingObjects(1)
' Set a range on the active sheet equal to the range object text ' that you are interested in copying to the text box. Set theRange = ActiveSheet.Range("A1:A10")
'Set the starting position for the text. startPos = 1
' Create a For-Each construct to loop through the cells in the range.
For Each cell In theRange
' Populate the textbox with the cell values using the Characters ' method. ' Note: Chr(10) can be used to add a new line in the textbox for ' each cell. txtBox1.Characters(start:=startPos, _ length:=Len(cell.Value)).Text = cell.Value & Chr(10)
' Update the startPos variable to keep track of where the next ' string of text will begin in the textbox. startPos = startPos + Len(cell.Value) + 1
Next cell End Sub
Salutations!
"lydya" a écrit dans le message de news: %
Bonjour,
J'essaie de copier par macro le contenu d'un textbox (BO formulaires) dans une cellule et je ne récupère que 255 caractères au plus. Comment puis-je récupérer tout le contenu du textbox dans ma cellule quand il fait plus de 255 caractères? Merci par avance de votre aide.