#1
|
|||
|
|||
Word Forms - importing data from one form to another
Hello all - I have a MS Word form that has been in use for several years, but changes slightly each year with small changes in wording, added content, etc. Because of these changes, a "Save As" won't work.
Is there any way to import data entered on last year's form to this year's form within Word? The solution needs to be fairly simple, as it will need to be utilized by pretty basic users in order to be useful. Thanks in advance for your assistance! |
#2
|
||||
|
||||
What are you trying to import?
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
I am trying to find a way for users to import or copy the data completed on the form from last year onto this year's form. This is about a 20 page document (protected, fillable form in MS Word) and approximately 80% of the data is the same from year to year, but users are manually needing to re-type/re-key the same information from year to year because the form changes slightly. We do literally hundreds of these documents a month and these are high paid clinicians, so it would be a major timesaver/$$ saved.
I have searched this and other online forums but have not found an answer to this issue. It feels like something that should be able to be accomplished, but is above my knowledge/skill level. We are able to do this with forms in Adobe PDF on a regular basis using the import/export function even if the form has slight edits/changes from time to time. |
#4
|
||||
|
||||
OK, so it seems you're using formfields. Are they always the same set of formfields and are all the formfields in the same order between the two documents (including none being added/deleted)?
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
There are some minor changes to the form fields from year to year which is the barrier. Even if there was a way to transfer a lot or even some of the data, it would be hugely helpful. The majority is the same, but we have required changes that are unpredictable from year to year.
|
#6
|
||||
|
||||
In that case, do the formfields with the data to be transferred use the same bookmark names in both documents? If not, you probably need to set them up that way. Otherwise any automated data transfer would be just too hit & miss.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#7
|
|||
|
|||
Yes they do have the same bookmark names, thanks again for your help!
|
#8
|
||||
|
||||
Try the following macro. It allows the user to select a single new form to use as a template for the output files, then an output folder, then all the source files from which the data are to be transferred. A new output document is created in the output folder with the same name as each of the source files. Output files are saved in the .docx format.
Code:
Sub DataReplication() Dim NewFile As Variant, OldFile As Variant, StrFoldr As String Dim DocSrc As Document, DocTgt As Document, FmFld As FormField With Application.FileDialog(msoFileDialogFilePicker) .Title = "Please select the new form" .AllowMultiSelect = False .Filters.Add "Documents & Templates", "*.doc*; *.docx; *.dot*", 1 'use Show method to display File Picker dialog box and return user's action If .Show = -1 Then NewFile = .SelectedItems(1) Else Exit Sub End If End With StrFoldr = GetFolder(Title:="Select the Destination Folder", RootFolder:="C:\Users\" & Environ("UserName")) If StrFoldr = "" Then Exit Sub With Application.FileDialog(msoFileDialogFilePicker) .Title = "Please select the old documents" .AllowMultiSelect = True .Filters.Add "Documents", "*.doc; *.docx", 1 'use Show method to display File Picker dialog box and return user's action If .Show = -1 Then 'step through each item in the collection For Each OldFile In .SelectedItems Set DocTgt = Documents.Add(NewFile, Visible:=False) Set DocSrc = Documents.Open(OldFile, AddToRecentFiles:=False, Visible:=False) With DocTgt For Each FmFld In .FormFields FmFld.Result = DocSrc.FormFields(FmFld.Name).Result Next .SaveAs StrFoldr & "\" & Split(DocSrc.Name, ".")(0) & ".docx", FileFormat:=wdFormatXMLDocument, AddToRecentFiles:=False .Close False End With DocSrc.Close False Next Else Exit Sub End If End With End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
importing Access data to a Word document | WayneCusack | Word VBA | 2 | 12-24-2012 12:26 AM |
Print word form using excel data sheet | LS1015 | Office | 1 | 07-16-2012 08:16 PM |
word form data | Jasafras2 | Word VBA | 1 | 05-27-2011 03:12 PM |
*Big One* feeding sql server data into MS Word 2007 forms | vafo | Mail Merge | 0 | 02-03-2010 04:49 AM |
Forms - linked form boxes | m.beharry | Word | 2 | 07-03-2009 09:12 AM |