Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Feb 2002
    Location
    Reading, UK
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Word VBA problem: InsertFile command (Word 97 VBA)

    Here's a weird one for you.

    The selection.InsertFile command doesn't seem to behave well with graphics in the header/footer sections. The header/footer sections will only be inserted successfully if:

    1.) The header/footer section does not have any graphics
    2.) A page break is done before inserting the graphic in the header/footer section.

    I don't know if this is a Microsoft bug. I have been searching on the web (without much success) for info on this.

    Has anyone seen this before? I guess the workaround is to get the code to copy and paste the header/footer sections, unless anyone knows of a better way around this problem??

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

    Re: Word VBA problem: InsertFile command (Word 97 VBA)

    Sounds interesting, but there are a number of things in your post that need clarification before anyone can look for a reasonable answer:

    Are you using the .InsertFile command to insert content into a header/footer, or are you somehow trying to insert a header/footer via .InsertFile (don't think you can do the latter<g>).

    Is the problem arising because your existing header/footer already contains a graphic, or are you trying to insert a graphic into an existing header/footer which does not yet contain one? (you should be able to do the latter).

    Page break before inserting the graphic - please clarify: you can't insert a page break into a header/footer.
    Do you have the section set up with "Different first page"?
    Are you trying to insert the graphic into the second header/footer in a section that is set up with "Different first page"? - as much detail as possible about how you have the document set up would be helpful.

    Could you post an abridged sample of the document so we can see the layout?
    Could you post the relevant sections of the code which isn't working for you?

    Gary

  3. #3
    New Lounger
    Join Date
    Feb 2002
    Location
    Reading, UK
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Word VBA problem: InsertFile command (Word 97 VBA)

    What my code was trying to do is insert a file with existing header/footers into the current document. The header/footers don't come up if there is a graphic in it.

    As it is, I have resolved it by making the code insert a section break before the .insertfile command and then deleting the section break afterwards. Works to a t.

    cheers for replying anyway.

Posting Permissions

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