![]() |
#16
|
||||
|
||||
![]()
In that case, all you should need to do is change "MyField" to 4.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#17
|
|||
|
|||
![]()
I got it to pull the info into the target document, but the information is halfway down the document and is not indented, nor is there a space after the first formfield text. You have done a plenty already and if you say enough is enough, i'll certainly understand. , but can this be tweaked to insert it close to the RE: in the heading, with a indent of the first line of each text with a space between each text.
See attached forms: one is where the text is being placed "halfway down" the other is where It should be placed with an indention and space. |
#18
|
||||
|
||||
![]() Quote:
• The lack of indenting is because that's how the last paragraph (the one where the code starts inserting) is formatted that way. If you format the last paragraph with the required attributes, anything inserted by the code will retain that format. • The lack of a space between paragraphs is because you haven't specified any before/after spacing as part of the paragraph format. You could work around that by adding another '& vbCr' to 'wdTgtDoc.Range.InsertAfter .FormFields(4).Result & vbCr', but that really isn't how it should be done.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#19
|
|||
|
|||
![]()
I've run into a bit of a quandary!
This code works well and does exactly what I requested, but I have one doc form that has two formfields that need to be extract to the target document, It pulls the formfield 4 on all documents, but I can't get it to pull formfield 1 and formfield 4 on the first document. If it matters, the formfields for the source document that has two formfields are named MyField, and MyField1. It's only on one document. |
#20
|
||||
|
||||
![]()
OK, but how does one identify which document that is (e.g. the name, some unique content) and where the data from the first formfield is to go?
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#21
|
|||
|
|||
![]()
All documents are with different names. Let's call it Form1 for example. This document is the one with two formfields and the first formfield (MyField) should be the first paragraph in the target document followed by formfield two (MyField1).
|
#22
|
||||
|
||||
![]()
That suggests the document to which this applies might not be the first one to be opened. Allowing for that possibility -
On the end of: Dim StrFlds As String, i As Long add: , Rng As Range After: Set wdTgtDoc = ActiveDocument insert: Set Rng = wdTgtDoc.Characters.Last Change: wdTgtDoc.Range.InsertAfter .FormFields(4).Result & vbCr to: Code:
If .Name = "Form1.doc" Then Rng.InsertBefore .FormFields(1).Result & vbCr & .FormFields(4).Result & vbCr Else wdTgtDoc.Range.InsertAfter .FormFields(4).Result & vbCr End If
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#23
|
|||
|
|||
![]()
Wooo hoooo, Works a charm, Thanks again.
|
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Inserting spreadsheet data rows as form fields in a document | b3nz | Word | 3 | 03-31-2013 07:47 PM |
Form Fields in Word | jwm1346 | Word | 1 | 04-17-2012 07:02 PM |
![]() |
hbforsyth | Word | 9 | 11-14-2011 04:26 PM |
Calculating Form Fields in Microsoft Word | wubba80 | Word | 1 | 06-25-2010 12:42 AM |
Form fields in Word messed up | mba | Word VBA | 0 | 02-07-2010 09:54 PM |