Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Word
application.errors
conversions
docmanagement
drawing.graphics
formatting.longdocs
international
internet.assistant
mail
mailmerge.fields
menustoolbars
newusers
numbering
oleinterop
pagelayout
printingfonts
setup.networking
spelling.grammar
tables
vba.addins
vba.beginners
vba.customization
vba.general
vba.userforms
web.authoring
word6-7macros
word97vba
  
 
date: Tue, 23 Sep 2008 20:54:44 +0200,    group: microsoft.public.word.vba.general        back       


ContentControl   
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
date: Tue, 23 Sep 2008 20:54:44 +0200   author:   Flemming

Re: ContentControl   
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 !!!
date: Tue, 23 Sep 2008 15:12:47 -0400   author:   Greg Maxey RrOMEOgOLF

Re: ContentControl   
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 !!!
>
date: Wed, 24 Sep 2008 12:42:13 +0200   author:   Flemming

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us