Consulting

Results 1 to 3 of 3

Thread: Solved: Word copy text form field

  1. #1

    Solved: Word copy text form field

    Hello all

    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.

    [vba]Public Sub Copy1()
    ActiveDocument.FormFields("Text1b").Result = ActiveDocument.FormFields("Text1").Result
    End Sub[/vba]

    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.

  2. #2
    VBAX Wizard
    Joined
    May 2004
    Posts
    6,713
    Location
    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.

  3. #3
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •