I want to print a number of pages which depends on the number filled in in a Word content control. I tried referring to the object with this:
Set objCC = xFileName.SelectContentControlsByTag("q_179").Item(1)
Total = objCC
Counter = 0
Do
Counter = Counter + 1
xFolderItem.InvokeVerbEx ("print")
Loop While Counter < Total
Does anyone know a solution or spot something I'm missing in the code? If you need more info lmk!
I'm now using this, it didn't work before because the content control is inside a table. Thanks @jonsson for your answer!
counter = 0
ccvalue = CInt(objWordDocument.SelectContentControlsByTag("q_179").Item(1).Range.Text)
For Each Table In objWordDocument.Tables
Do
counter = counter + 1
xFolderItem.InvokeVerbEx ("print")
Excel.Application.Wait (Now + TimeValue("00:00:01"))
Loop While counter < ccvalue
Next