PDA

View Full Version : Cut FieldForm text & paste into Doc, then remove field



born2ice
02-23-2009, 01:11 PM
I would like to loop through form fields, taking the text from the field and pasting after field and then remove the field.

I would like to built the doc from the user entered data.

macropod
02-24-2009, 01:55 AM
OK, so what code have you got so far, and which parts are you having trouble with?

Note: VBA Express is not a free coding service.

fumei
02-24-2009, 09:52 AM
"I would like to loop through form fields, taking the text from the field and pasting after field and then remove the field. "

That is very easy to do. It can be done in just a couple of lines of code. However, what is the connection to:

"I would like to built the doc from the user entered data."

That tells us nothing. As macropod mentions, please post what code you have so far and what you may be having trouble with.

As I mentioned, getting the text from the text formfield and deleting the formfield is quite easy to do.

born2ice
02-24-2009, 10:48 AM
One department fills out the locked form and sends to legal. They will review and run other macros to remove watermark and other text. The document that Legal send to the client can not have any Form Fields in. So I need to take the value in the form field and remove form field, replacing it with normal text in the place of the form field.

Sub ReplaceFields()
For Each ctl In ActiveDocument.FormFields
strValue = ctl.Result
'Take Value and insert Before or after field
'Then remove field
Next
End Sub

fumei
02-24-2009, 11:20 AM
I have no interest in why you need to do this. It is legitimate to want to do so.

1. please use the code tags when posting code.

2. I strongly suggest using Option Explicit in all your code modules. This forces you to declare all your variables. Your snippet above does not declare anything. Bad idea.

3. So...what have you actually tried to get:

'Take Value and insert Before or after field
'Then remove field

to work?

4. "'Take Value and insert Before or after field"

I suggest you make a decision on that...you have to pick one. Of course you could easily build that decision into the process, but if you need that...you have to STATE that.

5. you did not answer my question.