Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    May 2002
    Location
    Smithfield, Free State, South Africa
    Posts
    210
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Current Section object select in Word (Word 2000)

    Hi folks
    I am working with a Word document that has many sections. In the header/footer area of some of the sections are text boxes. I beak the Same as Previous link.
    When I insert a new page, the text box still appears in the new section. What I have to do, is select the text box and delete it from that section only.
    How can I write a macro in Word that will delete the text box from that one section only. (The sections numbers will change as the document increases in size, therefore I need to specify the active section without a number.)
    Please help!!!!

  2. Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

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

    Re: Current Section object select in Word (Word 2000)

    You should be able to do something like..

    If Selection.Sections(1).Footers(wdHeaderFooterPrimar y).Shapes.Count =1 Then
    Selection.Sections(1).Footers(wdHeaderFooterPrimar y).Shapes(1).Delete
    End If

    StuartR

  4. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 16 Times in 16 Posts

    Re: Current Section object select in Word (Word 2000)

    I don't think this is easy. There was a thread about something similar a while ago, but it has probably been removed in the recent massive culling of posts.

    Word seems to think that all shapes (text boxes etc.) belong to the first header section, so it is not easy to find out which one to delete. But probably one of the Word gurus will come up with a solution. <img src=/S/crossfingers.gif border=0 alt=crossfingers width=17 height=16>

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

    Re: Current Section object select in Word (Word 2000)

    Having given the incorrect information, the least I can do is offer the following solution...

    Dim i As Integer
    With Selection.Sections(1).Footers(wdHeaderFooterPrimar y)
    For i = .Shapes.Count To 1 Step -1
    If .Shapes(i).Anchor.InStory(.Range) Then
    .Shapes(i).Delete
    End If
    Next i
    End With

    StuartR

  6. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 16 Times in 16 Posts

    Re: Current Section object select in Word (Word 2000)

    Nice! After an initial mistake on my side it works fine!

Posting Permissions

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