MS Office Forum / Word / Programming / November 2005
insertfile doesn't include footer...
|
|
Thread rating:  |
Mike Iacovou - 09 Nov 2005 02:31 GMT hi.
I am trying to insert an RTF document into a document running VBA. I am using:
Selection.InsertFile FileName:=FNameAndPath, Range:="", ConfirmConversions:=False, Link:=False, Attachment:=False
where FNameAndPath is the full windows path to the file. This inserts the RTF document exactly, including bookmarks etc. Howeverm it doesn't include the footer information. I then tried to simply open the RTF file and copy/paste the wholestory - again this failed to copy the footer. I am hoping to be able to change the footer information using VBA (and had achieved this using a bookmark in the footer)... but as the bookmark / footer insn't being included, this is now failing ? Any means of either: 1. including an RTF including FOOTER or, 2. accessing FOOTER text via VBA
TIA
Anne Troy - 09 Nov 2005 03:34 GMT To my knowledge, RTF means Rich Text Format, and doesn't include headers, footers, or bookmarks. To wit, save a file as RTF and open with WordPad. ************ Anne Troy www.OfficeArticles.com
> hi. > [quoted text clipped - 18 lines] > > TIA Mike Iacovou - 09 Nov 2005 04:01 GMT thanks anne. i have some RTF documents that include footers... and to that end even have bookmarks within the footer when opened in word... so those control codes seem to be supported.
mike
> To my knowledge, RTF means Rich Text Format, and doesn't include headers, > footers, or bookmarks. To wit, save a file as RTF and open with WordPad. [quoted text clipped - 24 lines] > > > > TIA Anne Troy - 09 Nov 2005 04:07 GMT Perhaps they include footers when you open them with Word... have you tried opening them with WordPad, which reveals the "real" RTF format? ************ Anne Troy www.OfficeArticles.com
> thanks anne. > i have some RTF documents that include footers... and to that end even [quoted text clipped - 36 lines] >> > >> > TIA Mike Iacovou - 09 Nov 2005 05:47 GMT that won't help me with the problems at hand (no footers in wordpad). thanks anyway :)
> Perhaps they include footers when you open them with Word... have you tried > opening them with WordPad, which reveals the "real" RTF format? [quoted text clipped - 42 lines] > >> > > >> > TIA Anne Troy - 09 Nov 2005 06:13 GMT Sorry, Mike. I understand that and I'm trying to get you to understand that RTF files do not have headers, footers, and bookmarks. The only reason you still see them is because you're opening them in Word and, to my knowledge, that IS the only way you'll get them. That's why your automation isn't working. Change the RTFs to Word docs and your automation should work fine. ************ Anne Troy www.OfficeArticles.com
> that won't help me with the problems at hand (no footers in wordpad). > thanks [quoted text clipped - 54 lines] >> >> > >> >> > TIA Mike Iacovou - 09 Nov 2005 07:22 GMT that's just it... even as a word document, it doesn't work. if i open the file, the footer is there - but when i insert the file using insertfile, the footers' are gone. Once again, i use:
Selection.Collapse Direction:=wdCollapseEnd Selection.InsertFile FileName:=FNameAndPath, Range:="", ConfirmConversions:=False, Link:=False, Attachment:=False
TIA
Anne Troy - 09 Nov 2005 15:07 GMT Okay, I see. So what is happening is this... when you want the footer from a new document to come in (I'm no coder but did manage just such a project), you have to (manually) go to the end of the existing document. View the header and footer and turn OFF same as previous (Link to previous in 2003). You may also have to turn this off in the doc you're inserting, which as I recall we weren't able to accomplish since there is no "previous" before you insert it and after you insert it, it's too late, but try anyway. Your inserted document is taking on the footers of the document into which you're inserting because of the same as (link to) previous setting. Some of the information here might help: http://www.officearticles.com/word/understanding_section_breaks_in_microsoft_word.htm Let me know if you have any more questions, tho. I'll do what I can to help. ************ Anne Troy www.OfficeArticles.com
> that's just it... even as a word document, it doesn't work. if i open the > file, the footer is there - but when i insert the file using insertfile, [quoted text clipped - 7 lines] > > TIA Mike Iacovou - 09 Nov 2005 15:58 GMT many thanks. that makes sense. what i find is: 1. the files that are to be inserted have no "previous / link to" state (as you expected) 2. once inserted, even using "different header/footer" etc options, the footer of the document being inserted is lost. When i access the header/footer toolbar, again there is no previous/link to state, so no scope there.
i can't see any other options to assist.
if there is a means of inserting a document and adopting its page setup / footer settings, then that will work. the only alternative would be to programmatically access the document to be inserted, read it's footer information, set the current document information to the same via vba, and then insert the document as before - but as far as i can tell vba access to footers etc is fairly sketchy. any further pointers greatly appreciated.
Charles Kenyon - 09 Nov 2005 18:05 GMT Headers and footers are a part of section formatting. You need to be bringing in the section mark at the end. http://word.mvps.org/FAQs/Formatting/WorkWithSections.htm http://word.mvps.org/FAQs/Formatting/PasteWithoutSectionInfo.htm
You may need to modify your source document by inserting a continuous section break at the end.
 Signature Charles Kenyon
Word New User FAQ & Web Directory: http://addbalance.com/word
Intermediate User's Guide to Microsoft Word (supplemented version of Microsoft's Legal Users' Guide) http://addbalance.com/usersguide
See also the MVP FAQ: http://word.mvps.org/FAQs/ which is awesome! --------- --------- --------- --------- --------- --------- This message is posted to a newsgroup. Please post replies and questions to the newsgroup so that others can learn from my ignorance and your wisdom.
> many thanks. > that makes sense. what i find is: [quoted text clipped - 17 lines] > footers etc is fairly sketchy. > any further pointers greatly appreciated. Anne Troy - 10 Nov 2005 21:32 GMT Thank you, Charles, because now that you mention it, that's EXACTLY what we did. Then, once you've inserted all the files, you go to the last section, make it SAME as previous, then delete that extra section break. (All this with code of course.) But that'll only work if there was no different first page or different odd and even setups. Mike, if you think it'd be helpful to see the code for this, email me. It was paid for, and there's pages of it, so I'm not hot to post it in the open. ************ Anne Troy www.OfficeArticles.com
> Headers and footers are a part of section formatting. You need to be > bringing in the section mark at the end. [quoted text clipped - 25 lines] >> footers etc is fairly sketchy. >> any further pointers greatly appreciated.
|
|
|