View Single Post
 
Old 08-27-2018, 06:36 AM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,176
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

So you need to change the loop to only look for particular text CCs. I would do this by using the CC Title property to nominate which text CCs are meant to feed the XL workbooks
Code:
Function UpdateXL(xlWkBk As Object)
  Dim aCC As ContentControl, sSheet As String, sCell As String, sValue As String
  For Each aCC In ActiveDocument.SelectContentControlsByTitle("Excel Data")
    If aCC.Type = wdContentControlText Then
      sSheet = Split(aCC.Tag, "!")(0)
      sCell = Split(aCC.Tag, "!")(1)
      sValue = aCC.Range.Text
      xlWkBk.Sheets(sSheet).Range(sCell).Value = sValue
    End If
  Next aCC
End Function
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote