Results 1 to 8 of 8
  1. #1
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Insert File (97SR2)

    When I use:

    Selection.InsertFile FileName:="TheDoc"

    to insert TheDoc into another doc, TheDoc page definition is lost. It inherits the page definition of the document into which it is inserted.

    Can I insert it so that the page setup for TheDoc remains?
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  2. #2
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Insert File (97SR2)

    Hi Kevin,

    My understanding of how InsertFile works is that it's kind of like copying in the file content, minus the last paragraph mark. And since the last paragraph mark holds the section formatting information (for the entire document in a 1-section document, and for the last section in a multisection document) the inserted file (or at least its final section) is going to take on the section formatting of the last section of the host document.

    There's no way around that behavior of InsertFile (that I know of), so the only workaround that comes to mind is an ugly one: open TheDoc, go to the end of the document and insert a NextPage section break (which will automatically have the same properties as the last section/paragraph mark).
    That way when the InsertFile happens, it will take that last section break with it.
    That is ugly though....

    Gary

  3. #3
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Insert File (97SR2)

    Gary,

    Thanks for the low down. I've been experiementing with various section break ideas, and you're right, it's pretty ugly. The best I've been able to do is get everything just right except I get an extra blank page at the end. If I delete that "page", I delete the sectionbreak and there goes the formatting...

    Oh well.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  4. #4
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Insert File (97SR2)

    Once upon a time, at a different company, in an early dialect of WordBasic, I wrote a macro that copied the key section attributes from one to another so that I could safely delete a section break. I don't really remember the details, but since it's mostly the page setup and headers/footers, it's not too daunting if it really matters... if you were to write one, I probably could use it in the future.

  5. #5
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Insert File (97SR2)

    Rather than delete the last 'page', convert the last section break to a Continuous one. You'll still have that extra section but it won't be noticeable since there won't be an extra page.

  6. #6
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Insert File (97SR2)

    On second thought, scratch the continuous section break suggestion; that would just leave you back with the first problem, wouldn't it?

  7. #7
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Insert File (97SR2)

    Yes, it would. I'll keep banging on it. Thanks for your futher thoughts..
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  8. #8
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Insert File (97SR2)

    Just a final follow up on this topic: I did get it to work by adding a sectionbreakcontinuous to the top of TheDoc (which is really TheDot! -- see below).

    The code below executes before TheDoc is inserted. I also added a line of code to adjust the top margin of the new section (into which TheDoc will be inserted). If I don't do that, TheDoc inherits the 1" top margin of the "mother" document.

    I didn't mention previously that TheDoc is really TheDot. No subterfuge intended (and I'm sure it has no bearing on the issue -- but, if you are interested, the TheDot is used to create separate docs AND inserted docs depending on the situation).

    Selection.EndKey unit:=wdStory
    Selection.InsertBreak Type:=wdSectionBreakNextPage
    ActiveDocument.Sections.Last.PageSetup.TopMargin = InchesToPoints(0.5)
    Selection.InsertFile FileName:=vLibLoc & MiscDocName & ".dot"

    Thanks again for helping me think this one through.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

Posting Permissions

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