Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Jun 2003
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Headers & Footers - turning off Same As Previous (Word 97 and 2000)

    I need to turn off Same as Previous in the header and footer of a section of a Word document using VBA code. The problem is a runtime error 4605 often occurs saying the command is unavailable. I think this is a bug, as I have also tried recording the macro to do it but when I play the recorded macro back it also has the runtime error. This problem occurs regularly in 97 but intermittently in 2000.
    (I have made sure that I am not in Section 1 because this is the only time SAP couldn't be accessed)

    Has anyone come across this before and if so, has anyone found a way around it???

    By the way, the code I use is below: (this is a function which I pass in the section (psecSection) object and pblnLink (true or false) which in my case I am passing in False.

    With psecSection
    .Headers(wdHeaderFooterPrimary).LinkToPrevious = pblnLink
    .Footers(wdHeaderFooterPrimary).LinkToPrevious = pblnLink
    If .PageSetup.OddAndEvenPagesHeaderFooter Then
    .Headers(wdHeaderFooterEvenPages).LinkToPrevious = pblnLink
    .Footers(wdHeaderFooterEvenPages).LinkToPrevious = pblnLink
    End If
    End With

    Any help would be much appreciated as I am really stumped with this one.

    Cheers
    Helen

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Headers & Footers - turning off Same As Previous (Word 97 and 2000)

    Welcome to Woody's Lounge!

    I've never seen this error and I tried your code in several Word 97 documents with multiple sections, but I couldn't reproduce the error. Could you post a dummy document that causes the error? If you have an existing document, make a copy and replace the text by some dummy text.

  3. #3
    New Lounger
    Join Date
    Jun 2003
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Headers & Footers - turning off Same As Previous (Word 97 and 2000)

    Hans,

    I rebooted my machine and tried the same document and other documents and the runtime error does not occur. This made me realise that the times this runtime error does actually occur must be due to low memory which makes sense thinking about the times when it has occurred. I usually give Word a pretty good "work out" so I now know its a sign Word needs a reboot when it does occur. I've tried this on a low spec machine and it happens regularly.

    Thank you for your time. It is appreciated.

    Regards
    Helen

Posting Permissions

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