PDA

View Full Version : Solved: Word copy text form field



cubbycub
09-25-2007, 04:52 AM
Hello all :help

I have designed a Deilvery Note form (which will need to be used on both Word 2007 and 2003) where I have 10 text form fields that when they are exited are copied to a second sheet using.

Public Sub Copy1()
ActiveDocument.FormFields("Text1b").Result = ActiveDocument.FormFields("Text1").Result
End Sub

When the string gets too long i get an error
run time error '4609'
string too long.

Is there a neater way of doing this where I can have longer strings with formating.

I think I will also in time need to add a third sheet that the info will have to be copied to (customer copy, return copy, and file copy). so the whole 20 seperate macros will grow by another 10 and i understand that this will effect the document in that it will become slow to use? (just somthing i heard once).

Anyway any help would be very much appreciated.

fumei
09-25-2007, 07:40 AM
1. I have no idea what you mean by "second sheet". Sheet?

2. It would be better, if all you want is a copy of content, to use a field. Either REF field, or a blank field with the same name.

So where you have Text1b - and BTW, using the default names (Text1, Text2) is a bad practice - simply put in a field.

Press Ctl-F9
Type the name of the source

As in:

Ctl-F9
"Text1" - no quotes.

If the formfield Text1 has Calculate on exit checked, then the new field will automatically be the .Result.

Having it as a bunch of separate macros is not efficient at all.

cubbycub
09-25-2007, 08:39 AM
My fault completely I didnt make myself clear at all.

I have a form (a dellivery note), that has areas where a user can type in the relevent information about the delivery of an item
(information such as Customer name, Customer Order number, project title, date, ... etc.)

The original process for filling this form would be to type all the information in and the copy paste it into an almost identical form, the second form being a copy of the original but with additional information telling the customer where to sign and how to return the form thus acknowledging reciept.

My intention was that as the user is filling in the form, the second form is completed automatically. This works ok'ish with the afore mentioned macro but with one problem. When the user input gets too long I get the afore mentioned error.

I have forseen that in the not-to-distant future, a third, slightly differing again, copy of the form will be required with additional information for the project manager on where to store the paper copies.