Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #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,144
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 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
 

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 01:08 AM.


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