Results 1 to 4 of 4
  1. #1
    Lounger
    Join Date
    Feb 2006
    Location
    Washington, District Of Columbia
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Footer Macro (2003)

    Hi All,

    I have the following macro that toggles between adding "Celebrating our 40th Anniversary" to our letterhead template (which I can't see or change since it was created by an outsourced company years ago ). The problem that I'm running into is that it will not update the first page footer since it is a Different first page footer. How will I be able to implement it so that it does it to every footer in the document.

    I'm not very good at programming and I'm just learning... so any help will be appreciated. Hopefully, I'll be able to take some classes soon.

    ~Cris


    Sub ToggleFooter40()
    '
    ' ToggleFooter40 Macro
    ' Macro created 3/14/2006 by cryabinkin
    '
    Const strText = "Celebrating Our 40th Anniversary"
    With ActiveDocument.Sections(1).Footers(wdHeaderFooterP rimary).Range
    If InStr(.Text, strText) > 0 Then
    .Delete
    Else
    .Text = vbTab & strText
    ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
    Selection.WholeStory
    Selection.Font.Name = "EngraversGothic BT"
    Selection.Font.Size = 16
    Selection.Font.Bold = wdToggle
    ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
    End If
    End With
    End Sub

  2. #2
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Footer Macro (2003)

    Does this do what you need?

    StuartR

    <code>
    Sub ToggleFooter40()
    <font color=448800>'
    ' ToggleFooter40 Macro
    ' Macro created 3/14/2006 by cryabinkin
    ' Modified to toggle all headers in the first section of the document by StuartR
    '</font color=448800>
    Const strText = "Celebrating Our 40th Anniversary"
    Dim ftrNext As HeaderFooter

    For Each ftrNext In ActiveDocument.Sections(1).Footers
    With ftrNext.Range
    If InStr(.Text, strText) > 0 Then
    .Delete
    Else
    .Text = vbTab & strText
    .Font.Name = "EngraversGothic BT"
    .Font.Size = 16
    .Font.Bold = wdToggle
    End If
    End With
    Next ftrNext

    End Sub
    </code>

  3. #3
    Lounger
    Join Date
    Feb 2006
    Location
    Washington, District Of Columbia
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Footer Macro (2003)

    Yes, thank you very much!!! I was going crazy already. I tried a Next command but for some reason I couldn't get it to work.

    Thanks again!!!

  4. #4
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Footer Macro (2003)

    I suspect that you want to change
    <code> .Font.Bold = wdToggle</code>
    to
    <code> .Font.Bold = True</code>

    but if it works for you then that's great.

    StuartR

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •