![]() |
#7
|
|||
|
|||
![]()
Yes, I actually named it MyField to test
On the word template I have a text formfield that for the bookmark name; I named it "MyField". Code:
Sub ProcessDocuments() Application.ScreenUpdating = False Dim strFolder As String, strFile As String, wdSrcDoc As Document, wdTgtDoc As Document Dim StrFlds As String, i As Long StrFlds = "Form1,Form2,Form3" strFolder = GetFolder If strFolder = "" Then Exit Sub Set wdTgtDoc = ActiveDocument strFile = Dir(strFolder & "\*.doc", vbNormal) While strFile <> "" Set wdSrcDoc = Documents.Open(FileName:=strFolder & "\" & strFile, AddToRecentFiles:=False, Visible:=False) With wdSrcDoc wdTgtDoc.Range.InsertAfter .FormFields("MyField").Result & vbCr .Close SaveChanges:=False End With strFile = Dir() Wend Set wdSrcDoc = Nothing: Set wdTgtDoc = Nothing Application.ScreenUpdating = True End Sub Function GetFolder() As String Dim oFolder As Object GetFolder = "" Set oFolder = CreateObject("Shell.Application").BrowseForFolder(0, "Choose a folder", 0) If (Not oFolder Is Nothing) Then GetFolder = oFolder.Items.Item.Path Set oFolder = Nothing End Function wdTgtDoc.Range.InsertAfter .FormFields("MyField").Result & vbCr Form1, Form2, and Form3 need to be in paragraph form in sequential order on the target document |
|
![]() |
||||
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 |