ContentControl

F

Flemming

Hi,

I have several ContentControls with the same tag "MyTag".
How do I change the font.size for all tagged "MyTag" contentcontrols that
are located outside page 1?

Dim oCoc As ContentControl

For Each oCoc In ActiveDocument.ContentControls
If oCoc.Tag = "MyTag" Then
'some thing to ensure that this contentcontrol are not on page one??
oCoc.Range.Font.Size = 18
End If
Next oCoc

Thanks for you help,
Flemming
 
G

Greg Maxey

Unless you make page 1 a separate range (e.g., with a section break) then I
think you would have to physically select the CC:

Sub Test1()
Dim oCoc As ContentControl
Dim oRng As Range
Set oRng = ActiveDocument.Sections(1).Range
For Each oCoc In ActiveDocument.ContentControls
If oCoc.Tag = "MyTag" Then
If Not oCoc.Range.InRange(oRng) Then
oCoc.Range.Font.Size = 18
End If
End If
Next oCoc
End Sub


Sub Test2()
Dim oCoc As ContentControl
For Each oCoc In ActiveDocument.ContentControls
If oCoc.Tag = "MyTag" Then
oCoc.Range.Select
If Selection.Information(wdActiveEndPageNumber) > 1 Then
oCoc.Range.Font.Size = 18
End If
End If
Next oCoc
End Sub
Hi,

I have several ContentControls with the same tag "MyTag".
How do I change the font.size for all tagged "MyTag" contentcontrols
that are located outside page 1?

Dim oCoc As ContentControl

For Each oCoc In ActiveDocument.ContentControls
If oCoc.Tag = "MyTag" Then
'some thing to ensure that this contentcontrol are not on page
one?? oCoc.Range.Font.Size = 18
End If
Next oCoc

Thanks for you help,
Flemming

--
Greg Maxey - Word MVP

My web site http://gregmaxey.mvps.org


McCain/Palin '08 !!!
 
F

Flemming

Thanks Greg

I will try go with your Test2 or put in a section break continous on the
first page to make Test1 work or add a loop running only in
Section(2).Range.ContentControls

Thanks for your pointers :)
Flemming
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top