Strongs
09-11-2007, 09:57 AM
Hi Guys,
I have a document that has a UserForm with TextBoxes. When the user completes the UserForm, the TextBox contents are assigned to a FormField in the document. The code I am using works fine, but the when the text is inerted into the FormField there seems to be odd behaviour.
The FormField is set to be a numbered list with alpha characters, so if the user starts a new paragraph in the UserForm TextBox by hitting Return Key, the subsequent text entered into the FormField when the UserForm is submitted, will increment by x number of alpha characters i.e. para 1 = a. para2 = b. etc;
I have tried this by manually entering the text into the FormField and it works fine: hit the return key at the end of a paragraph and as expected the a paragraph starts on a new line with an incremented alpha character.
However, when the UserForm TextBox is submitted this is not happening. The additional paragraph(s) simply wrap underneath the first paragraph alpha.
Additionally, there was a problem with a square box symbol appearing on the next paragraph line when submitted through the UserForm, but after some research on the net found that this was down to Chr(10) causing this problem. The TextBox seems to be set to CrLf when it is submitted.
I have solved this problem by using the Replace function to remove the erroneous Chr(10) and hey presto, no more square box symbol.
The code I am using is shown below and attached is a document with images of what is occuring when the UserForm is submitted.
It is driving me crazy, so any help that you can offer would be greatly appreciated. The document is good to go apart from this annoying problem.
Regards,
If Me.Interest = "" Then
ActiveDocument.FormFields("Int").Result = "Enter info here"
Else
ActiveDocument.FormFields("Int").Result = Replace(Interest, Chr(10), "")
End If
I have a document that has a UserForm with TextBoxes. When the user completes the UserForm, the TextBox contents are assigned to a FormField in the document. The code I am using works fine, but the when the text is inerted into the FormField there seems to be odd behaviour.
The FormField is set to be a numbered list with alpha characters, so if the user starts a new paragraph in the UserForm TextBox by hitting Return Key, the subsequent text entered into the FormField when the UserForm is submitted, will increment by x number of alpha characters i.e. para 1 = a. para2 = b. etc;
I have tried this by manually entering the text into the FormField and it works fine: hit the return key at the end of a paragraph and as expected the a paragraph starts on a new line with an incremented alpha character.
However, when the UserForm TextBox is submitted this is not happening. The additional paragraph(s) simply wrap underneath the first paragraph alpha.
Additionally, there was a problem with a square box symbol appearing on the next paragraph line when submitted through the UserForm, but after some research on the net found that this was down to Chr(10) causing this problem. The TextBox seems to be set to CrLf when it is submitted.
I have solved this problem by using the Replace function to remove the erroneous Chr(10) and hey presto, no more square box symbol.
The code I am using is shown below and attached is a document with images of what is occuring when the UserForm is submitted.
It is driving me crazy, so any help that you can offer would be greatly appreciated. The document is good to go apart from this annoying problem.
Regards,
If Me.Interest = "" Then
ActiveDocument.FormFields("Int").Result = "Enter info here"
Else
ActiveDocument.FormFields("Int").Result = Replace(Interest, Chr(10), "")
End If