Consulting

Results 1 to 4 of 4

Thread: Inserting text from a different file into a template

  1. #1

    Inserting text from a different file into a template

    I'm sure this is pretty easy, but I have never done it before in Word. I am creating a template in Word 2007 and I have a custom dialog box that has 2 options. Depending on which option the user chooses, I would like to select a paragraph of text from a separate Word document on the c drive and then place that text into a bookmark in my template document. Can someone give me an example(s) on how to do this? Thanks.

  2. #2
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    Why not have both paragraphs already in the template and delete the one you don't want using your dialog box or radio buttons?

    Read it all but pay strict attention to the attachment in post #11

    http://vbaexpress.com/forum/showthread.php?t=13543
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  3. #3
    Try This to get the paragraph you want to your document.

    ActiveDocument.Bookmarks("Name").Select
    Selection.InsertFile FileName:="C:\File.doc", _
    Range:="BookmarkName", ConfirmConversions:=False, Link:=False, Attachment:=False

    Name is the name of the Text Form Field you are using or Bookmark you are using where you are going to put the paragraph in.

    The BookMarkName is the BookMark name you gave the paragraph in the other document. So depending which option you select will determine which bookmarkname you use.

  4. #4
    VBAX Wizard
    Joined
    May 2004
    Posts
    6,713
    Location
    Another option is to use an INCLUDETEXT field.

Posting Permissions

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