insertfile and section breaks

L

Larry

Hi, All --

I have a VBA program that inserts a file into the active document.
This file might have a section break at the end, and if it does, it
might be a page section break, or a continuous section break.

But invariably, when the file is inserted using selection.insertfile,
the section break becomes a page section break, no matter what kind of
section break it was in the original file. Does anyone know why this
is and what can be done to stop this from happening (or a workaround
to "transparently" correct it after the fact)? I need the type of the
section break to be maintained after the file insertion.

TIA--
--larry
 
T

Tony Jollans

What fun these things are!

A section break shows the start type of the *following* section. When you
copy a section (including its break) but not the following section, then how
the section break shows when pasted may change to reflect the section that
then follows it. If you want to change the start type of the section, which
already exists in your target document, based on the start type of a section
in your source document, you must expicitly code it yourself - copying and
pasting the section before it will never do it for you.
 
L

Larry

Ah, yes. Thank you, Tony. I had got myself turned around (again) on
these silly section breaks. The behaviour I see now is this: If I
insert a side file that has one or more section breaks, the final
section break will change to whatever type of section break was in
effect in the base file at the point of the insertion of the side
file.

Now if only I had code that could examine the type of the final
section break (if any) of the side file before inserting it...
hmm.... :)

----larry
 
L

Larry

Gotta be brief ...

    Range.Sections.Last.PageSetup.SectionStart

:)

Perfect! I just open the side file first, peek at its final section
break, close it, insert it, and reset the section break to what it is
supposed to be.

I don't care what everybody else says, you are okay in my book, Tony.
Thanks!
---larry
 
S

Stefan Blom

For more on section breaks and Insert File in Word, you may also want to
read the article at
http://word.mvps.org/faqs/formatting/WorkWithSections.htm.

--
Stefan Blom
Microsoft Word MVP


Gotta be brief ...

Range.Sections.Last.PageSetup.SectionStart

:)

Perfect! I just open the side file first, peek at its final section
break, close it, insert it, and reset the section break to what it is
supposed to be.

I don't care what everybody else says, you are okay in my book, Tony.
Thanks!
---larry
 
T

Tony Jollans

Sorry I was so brief but I was just on my way out the door for the weekend
(I'm back now :)) and I thought something was better than nothing. Glad it
worked for you.

--
Enjoy,
Tony

Gotta be brief ...

Range.Sections.Last.PageSetup.SectionStart

:)

Perfect! I just open the side file first, peek at its final section
break, close it, insert it, and reset the section break to what it is
supposed to be.

I don't care what everybody else says, you are okay in my book, Tony.
Thanks!
---larry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top