Thanks Greg. I'm running into a meeting that will be most of the day. I'll
try if over the weekend and let you know on Monday.

Signature
Debra Ann
> Or a little cleaner:
>
[quoted text clipped - 36 lines]
> End With
> End Sub
Debra Ann - 01 Nov 2005 16:09 GMT
Well I just got back from another rush that I worked on from last Friday
until just now and I have exactly 24 hours to get this done for a 9:00
meeting tomorrow morning. I can see this is going to be a nightmare. I knew
it when they told me they wanted it done (and they want it done ... no ifs,
ands or buts) so this should be fun trying to trap all the errors.
Thanks to all of you for your options. At least my clients is my company
and I can just take the hits when it doesn't work.
Debra Ann
Greg was telling us:
Greg nous racontait que :
> Or a little cleaner:
>
[quoted text clipped - 36 lines]
> End With
> End Sub
You have opened a real can of worms. ;-)
I did the exact same thing for a client 2 years ago.
It was a but more complicated because the first page of the Annex section
had to be preserved... but essentially, it was the same.
The OP has not considered the case when the current page finishes with a
manual page break... that can create unwanted effects (Namely, a blank page
after the newly inserted Landscape section).
Also, what if the current section is already landscape?
If the cursor is exactly before the last ¶ in the document, then the "\Page"
bookmark generates an error.
If you add a landscape section after section one, the landscape section is
now section 2 and what was section 2 is now section 3. If you remove the
"Same as previous" attribute on the landscape section, that's OK, but then
section 3 will have the landscape section header/footer because it is still
set to "Same as previous." So, before inserting a section you have to remove
the "Same as previous" attribute in the following section, and then insert
the landscape section...
Also, I do not understand what
oLinkHeader = False
oLinkFooter = False
do in your code. They are Boolean variables (Even tough they are not
assigned as such... :-) ) that take the value of the initial section
header/footer "Same as previous" attribute. Then they are always set to
false, but the inserted section is not affected... So I do not understand
the purpose for these lines of code.
Anyway, when I was finished, I had hundreds of line of code...If I remove
the constraints I had regarding some pages that were untouchable (Like the
first two in the document, the first page of the Annexe, and the nightmare
regarding the preservation of headers/footers, then I would still have a lot
of code, maybe that is because I went overboard with error trapping... I
tried to foresee every possible situation so that the client could not
comeback and say "When I do this, it screws up my document..."

Signature
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org
Greg - 28 Oct 2005 17:16 GMT
Uummm..., I guess I stepped in it with both feet <ssg> that's "sheepish
stupid grin"
I suppose my only saving grace was like Debra, I was rushing off to
something else as well. Fortunately my poor services rendered were
"free" and there is no client fee to return.
"oLinkHeader = False" was a complete brain puff attempt to abbreviate
the code.
Back to the drawing board on that.
Sorry Debra. Thanks JGM for so gently poking me in the eyes with this
one. I will go off and lick my wounds now ;-)
Jean-Guy Marcil - 28 Oct 2005 21:09 GMT
Greg was telling us:
Greg nous racontait que :
> Uummm..., I guess I stepped in it with both feet <ssg> that's
> "sheepish stupid grin"
[quoted text clipped - 9 lines]
> Sorry Debra. Thanks JGM for so gently poking me in the eyes with this
> one. I will go off and lick my wounds now ;-)
Sorry if it came across as "poking"...
All I meant to do was to point out some of the things that makes such an
endeavour complicated... just because this is a case of "been there, done
that" (and lost some hair in the process!)

Signature
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org
Greg Maxey - 28 Oct 2005 23:42 GMT
JGM,
Absolutely no harm, no foul. That post was botched from A-z. I did not
feel that you were poking. Remember, the smiley wink is meant to keep it
all in fun.

Signature
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.
> Greg was telling us:
> Greg nous racontait que :
[quoted text clipped - 18 lines]
> an endeavour complicated... just because this is a case of "been
> there, done that" (and lost some hair in the process!)
Debra Ann - 01 Nov 2005 18:10 GMT
Thank you all for your comments.
Greg, I was able to implement a good chunk of your code (using the less
cleaner version that you send before) and it worked great for my three areas
I was testing.
JGM, I took all of your other concerns an implemented them also except I am
struggling with the one on "If the cursor is exactly before the last
paragraph in the document, then the "\Page" bookmark generates an error. I
could probably test for the last paragraph before I selected the page but I'm
not sure on the code for that.
Any suggestions? I'm so close thanks to all of you.
---
Debra Ann
Greg - 01 Nov 2005 18:33 GMT
Debra Ann,
Quick and dirty, you could add the following at the begining:
If Selection.End = ActiveDocument.Range.End - 1 Then
Selection.MoveEnd wdCharacter, -1
End If
There is then the possibility the that last paragraph mark is all that
exist on a page and you would therefore move up to the preceeding page.
What are the odds of that though?
Debra Ann - 01 Nov 2005 19:46 GMT
Worked perfect. Thanks.

Signature
Debra Ann
> Debra Ann,
>
[quoted text clipped - 7 lines]
> exist on a page and you would therefore move up to the preceeding page.
> What are the odds of that though?
Jean-Guy Marcil - 02 Nov 2005 23:20 GMT
Greg was telling us:
Greg nous racontait que :
> Debra Ann,
>
[quoted text clipped - 7 lines]
> exist on a page and you would therefore move up to the preceeding
> page. What are the odds of that though?
Ever heard of Murphy's Law? ;-)
Not only that, it might be that the preceding page is a different section as
well!
To be thorough, the code should check for those situations...
Mine did, this is why it was so unbelievably long!

Signature
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org