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
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 Flemming wrote: > 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 Word MVP web site http://word.mvps.org McCain/Palin '08 !!!
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 "Greg Maxey" <gmaxey@mIKEvICTORpAPAsIERRA.oSCARrOMEOgOLF> wrote in message news:ervKdBbHJHA.4564@TK2MSFTNGP02.phx.gbl... > 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 > > Flemming wrote: >> 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 > Word MVP web site http://word.mvps.org > > McCain/Palin '08 !!! >