Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-18-2018, 11:13 AM
southern_junior southern_junior is offline Processing multiple versions of the same Word doc Windows 10 Processing multiple versions of the same Word doc Office 2016
Novice
Processing multiple versions of the same Word doc
 
Join Date: Jun 2018
Posts: 7
southern_junior is on a distinguished road
Default Processing multiple versions of the same Word doc


I need to develop a macro that methodically runs through 10 of the same word document(all saved in the same folder) and delete the filler text.

Context: I built a large document(100+ pages) and sent it out to some friends. They are filling in their own text and sending the file back to me. I only want to keep their responses.

Request: Develop a macro to delete all the words I sent out, and only see their responses. The document is very rigid and should be simple to select the section i sent out. no?
Reply With Quote
  #2  
Old 06-18-2018, 10:16 PM
gmayor's Avatar
gmayor gmayor is offline Processing multiple versions of the same Word doc Windows 10 Processing multiple versions of the same Word doc Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

See http://www.gmayor.com/extract_data_f...milar_docs.htm and
http://www.gmayor.com/ExtractDataFromForms.htm
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #3  
Old 06-19-2018, 05:25 AM
southern_junior southern_junior is offline Processing multiple versions of the same Word doc Windows 10 Processing multiple versions of the same Word doc Office 2016
Novice
Processing multiple versions of the same Word doc
 
Join Date: Jun 2018
Posts: 7
southern_junior is on a distinguished road
Default

These look great. This should be everything I need in the first link.

My follow up is how would I specify that I need the entire response extracted? without knowing how long the responses are, is it possible to point the code to look for everything after the "?" of question 1. up to the next number "2." before the question?

the format of the form is:

1. What is your preferred drink at starbucks?

[Please insert your answer here] (Note: this is the only space allowed for answer that is not protected in the entire document)

2. Do you ever order a breakfast sandwich?

[Please insert your answer here] (Note: again, this is the only available space for editing)

3. If you were to go to Dunkin Donuts, what would you order?

[Please insert your answer here] (Note: again, this is the only available space for editing)

and so on and so forth.
Reply With Quote
  #4  
Old 06-19-2018, 11:59 PM
gmayor's Avatar
gmayor gmayor is offline Processing multiple versions of the same Word doc Windows 10 Processing multiple versions of the same Word doc Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

You could have saved yorself a lot of grief had you used content controls for the answers, however ....


Post a sample of the document that shows how it is formatted. A page or two with example answers will suffice.
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #5  
Old 06-20-2018, 05:11 AM
southern_junior southern_junior is offline Processing multiple versions of the same Word doc Windows 10 Processing multiple versions of the same Word doc Office 2016
Novice
Processing multiple versions of the same Word doc
 
Join Date: Jun 2018
Posts: 7
southern_junior is on a distinguished road
Default

Its not to late to edit the format of the document. For security reasons, I cannot share more than an example of the format. The wuestion format above is repeated with the answers to the sections being sent out in restrict editing mode.

Question: If I insert rich text content controls boxes and tag them(q1, q2, q3) will that make the extract easier? will i have an issue when extracting based on the fact that file names will only differ by the authors name?

The authors have been instructed to submit via: INSERTNAME_starbucksorder.docx

example: Jenna.starbucksorder.docx , Hank_starbucksorder.docx, so on
Reply With Quote
  #6  
Old 06-20-2018, 05:22 AM
gmayor's Avatar
gmayor gmayor is offline Processing multiple versions of the same Word doc Windows 10 Processing multiple versions of the same Word doc Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

I had assumed that the forms had already gone out in their current form. As it is not too late to redesign the form, I would suggest that you use plain text content controls with the 'allow multiple paragraphs' option set.

For multiple choice questions use content control list boxes.

http://www.gmayor.com/insert_content_control_addin.htm will help you insert the controls, which should have unique tags to make data recovery easier.


http://www.gmayor.com/ExtractDataFromForms.htm will help you recover the returned data from the controls (and it includes a utility for checking the names and tags).


The naming of the files won't matter so much, provided when you save the returned files you don't overwrite existing files with the same names.
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #7  
Old 06-20-2018, 07:11 AM
southern_junior southern_junior is offline Processing multiple versions of the same Word doc Windows 10 Processing multiple versions of the same Word doc Office 2016
Novice
Processing multiple versions of the same Word doc
 
Join Date: Jun 2018
Posts: 7
southern_junior is on a distinguished road
Default

Thanks for the quick response. So the issue I am finding is that I can not put a discreet flag on each response.

Purpose: I want to be able to consolidate all responses from Q1.

Ultimate goal: display 1 file with all 10 responses to Q1. then a new file with all 10 responses to Q2. and so on and so forth.
Reply With Quote
  #8  
Old 06-20-2018, 08:04 PM
gmayor's Avatar
gmayor gmayor is offline Processing multiple versions of the same Word doc Windows 10 Processing multiple versions of the same Word doc Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Add Q1 the tags for Q1 etc. You can then process the controls that start (or end) with Q1. Youi can edit the tags easily enough with my second link.
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #9  
Old 06-21-2018, 04:51 AM
southern_junior southern_junior is offline Processing multiple versions of the same Word doc Windows 10 Processing multiple versions of the same Word doc Office 2016
Novice
Processing multiple versions of the same Word doc
 
Join Date: Jun 2018
Posts: 7
southern_junior is on a distinguished road
Default

so i must be doing something incorrectly then. here is my process:

1. place the content control.
2. Give each rich text content control a unique name with the same unique tag
3. run through the "Title/Tag form data fields" tool

3. is what is giving me issue. All of the filter tags appear to be the same. This is limiting me from querying a single question in the extract tool other than recoding all the content controls each time. Your help has been outstanding thus far. I really appreciate it.
Reply With Quote
  #10  
Old 06-21-2018, 05:30 AM
gmayor's Avatar
gmayor gmayor is offline Processing multiple versions of the same Word doc Windows 10 Processing multiple versions of the same Word doc Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

As I said in my initial response, every tag should be unique. You can however prefix the tags with a code that would enable you to identify and process tags that share a common prefix e.g. if you have 10 responses to Q1 then each of those responses would have a unique tag so for example you could tag them as
Q1Ans1, Q1Ans2, Q1Ans3, Q1Ans4 etc
You can then process content controls that have a tag that starts with Q1 to get the Q1 responses.
If you copy and paste the controls they will all have the same tag. If you use the add-in to retag them, you will also currently have to title them, though I may update the add-in to not require the title.
As you have a lot of controls, you could insert a control manually without title and tag and use the add-in utility to add titles and tags. If you enter only the title the tag will match the title which will save some time.
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #11  
Old 06-21-2018, 05:36 AM
southern_junior southern_junior is offline Processing multiple versions of the same Word doc Windows 10 Processing multiple versions of the same Word doc Office 2016
Novice
Processing multiple versions of the same Word doc
 
Join Date: Jun 2018
Posts: 7
southern_junior is on a distinguished road
Default

So i will have to go in and retag the content control after I receive all ten of my responses?

Sending out the file to my recipients, the answers would have all the same field tags. Q1 will be q1 for all of my response documents. Looking at the two plug ins "Extract Data from Forms" 3.3 and 3.5, the newer version, 3.5 seems to have lost the ability to filter. Or maybe I am not following the process correctly.
Reply With Quote
  #12  
Old 06-21-2018, 05:56 AM
gmayor's Avatar
gmayor gmayor is offline Processing multiple versions of the same Word doc Windows 10 Processing multiple versions of the same Word doc Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

The following macro (Macro1) will help you tag content controls in selected text, but surely you would want to tag the controls before you send out the files, in order to be able to get a meaningful result?

The extraction add-in was suggested on the basis that you wanted to extract all the data from your form. It extracts to an Excel worksheet from which you can process the data.

Alternatively you can use a macro to read ony the data required (see macro2)

Code:
Sub Macro1()
    TagControls "Q1Ans"
End Sub

Sub Macro2()
ReadControls "Q1Ans"
End Sub

Sub TagControls(strTag As String, Optional iStart As Integer = 0)
'Graham Mayor - http://www.gmayor.com - Last updated - 21 Jun 2018
Dim oCC As ContentControl
Dim i As Integer
    For i = 1 To Selection.Range.ContentControls.Count
        Set oCC = Selection.Range.ContentControls(i)
        oCC.Tag = strTag & CStr(i + iStart)
        oCC.Title = strTag & CStr(i + iStart)
        DoEvents
    Next i
lbl_Exit:
    Set oCC = Nothing
    Exit Sub
End Sub

Sub ReadControls(strTag As String)
Dim oCC As ContentControl
Dim oSource As Document
Dim oDoc As Document
    Set oSource = ActiveDocument
    Set oDoc = Documents.Add
    For Each oCC In oSource.ContentControls
        If oCC.Tag Like strTag & "*" Then
            If oCC.ShowingPlaceholderText = False Then
                oDoc.Range.InsertAfter oCC.Range.Text & vbCr
            End If
        End If
        DoEvents
    Next oCC
lbl_Exit:
    Set oCC = Nothing
    Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #13  
Old 06-21-2018, 06:04 AM
southern_junior southern_junior is offline Processing multiple versions of the same Word doc Windows 10 Processing multiple versions of the same Word doc Office 2016
Novice
Processing multiple versions of the same Word doc
 
Join Date: Jun 2018
Posts: 7
southern_junior is on a distinguished road
Default

I think this is exactly what I need.

My initial problem was that I am only sending one file out to all recipients and they will return it with a separate header in the file name. Thus I will essentially have 10 separate "Q1ans" but i will not have "Q1ans1", "Q1ans2", "Q1ans3" and so on and so forth.
Reply With Quote
  #14  
Old 06-21-2018, 08:33 PM
gmayor's Avatar
gmayor gmayor is offline Processing multiple versions of the same Word doc Windows 10 Processing multiple versions of the same Word doc Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

OK. You'll need to change it so that instead of having 10 separate Q1Ans they will have numbered Q1Ans (though if using the macro I posted you can still read them if they all have the same Tag) Content controls can have the same tag if you must.
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
Reply

Tags
delete text

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple versions of document in one (i.e. hide section) MatKus Word 4 03-20-2018 05:53 AM
Is there a way to modify multiple versions of a document simultaneously? junkman Word 6 09-08-2017 07:37 AM
Processing multiple versions of the same Word doc Saving multiple versions of a file automatically NickPetrofski Word 7 07-31-2017 04:14 PM
Batch processing:How to format multiple images (art effects & color) and then save them,all at once? spbone Word VBA 2 01-12-2016 04:46 AM
Multiple versions of Office on the same network. whatrudoingdave Office 1 04-30-2012 03:36 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:41 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft