Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

InsertFile fails to import Header

Status
Not open for further replies.

sheila11

Programmer
Dec 27, 2000
251
US
Hi everyone,

I have a template that imports the entire content from another Word Template with the line:

Selection.InsertFile strFileName

This code runs on different users' machines, and the variable strFileName contains the names of various Word Templates.

Some of the users complain that this code imports the main document properly, but fails to import the headers. Some other users tell me that on they find headers getting imported properly.

It works correctly on my machine. When I tried importing from the same template-file on another user's machine, it failed to import the headers.

I am puzzled. Is it influenced by the settings on the machine?

Any advice/pointers?
TIA,
Sheila
 
Hi Sheila,

Are the users who don't see the header using the Print layout view?

Another possible problem area, depending on how much of the source document you're copying, is that you may be carrying over what is nothing more than a 'same as previous' heading setting from the source document.

Cheers

[MS MVP - Word]
 
Thank you for your reply.

Yes, the users have Print layout view. Does it need to change?

Some of the source documents DO have the 'same as previous' heading setting. How should this setting be handled? [The requirement is that if they do have that setting, the resulting file needs to have the same setting.]

TIA,
Sheila
 
Hi Sheila,

If the users are using 'Print Layout' view, then any imported headers should display.

With the 'Same as Previous' section headings, if you import such a setting, the pasted data will then point to the target document's previous section heading - not the source document's previous section heading. Clearly, you'll need to either break the target document's 'Same as Previous' link and import the source document's actual heading into the Section, or import the source document's actual heading into the last preceing unlinked Section in the target document.

And if you're pasting from a selection that doesn't include a Section break, it doesn't matter what you do, you won't get the page headings. What code are you using?

Cheers

[MS MVP - Word]
 
Thanks, Macropod. But I still need some clarifications. Please bear with me.

1)Target document is one into which the content is to be imported.
2)Source document is the one FROM which the content is to be imported.

You mention that if Target document has "Same as previous" setting, then we get into problem.

Is that so?

Thanks a lot,
Sheila
 
No - if the *source* document has "same as previous", all that is imported is that "same as previous" setting and, then when it is in the target document, there is a different "previous" to point to.

Enjoy,
Tony

------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.

I'm working (slowly) on my own website
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top