Results 1 to 9 of 9
  1. #1
    2 Star Lounger
    Join Date
    Sep 2002
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Linked file questions (2000/XP/2003)

    Suppose you insert a file link with code like this:

    Selection.InsertFile FileName:="MyFile.doc", Range:="", _
    ConfirmConversions:=False, Link:=True, Attachment:=False

    Two questions:
    1. How can I programmatically update the link (i.e. programmatically do the same thing as clicking "Update Now" in the Edit->Links dialogbox)?
    2. When I'm ready to break the link, is there a way to eliminate the field which seems to represent the linked file but retain the field's content?

    Thanks...

    Dan

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Linked file questions (2000/XP/2003)

    1. ActiveDocument.Fields.Update to update all fields, or ActiveDocument.Fields(37).Update to update a specific field, or rngMyRange.Fields.Update to update the fields in a specific range.

    2. ActiveDocument.Fields(37).Unlink or rngMyRange.Fields.Unlink. Or manually, through Edit | Links... or by selecting the link and pressing Ctrl+Shift+F9.

  3. #3
    2 Star Lounger
    Join Date
    Sep 2002
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Linked file questions (2000/XP/2003)

    Thanks, Hans, as always...

    Dan

  4. #4
    2 Star Lounger
    Join Date
    Sep 2002
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Linked file questions (2000/XP/2003)

    I have another question. I have a file (call it FileA) open in one instance of Word, and I then create another instance of Word via:

    set appWord = new Word.Application

    I then add a document to the second instance of Word and insert a link to FileA like this:

    set objDoc = appWord.Documents.Add
    objDoc.SaveAs "FileB.doc"
    objDoc.Range.InsertFile "FileA", Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    I then make a change to FileA and update FileB like this:

    objDoc.Fields.Update

    However, FileB does not reflect the changes in FileA. On the other hand, if I open FileB in the same instance of Word as FileA, the FileB does get updated. Is there
    way to do what I'm trying to do--or do I need to put FileB in the same instance as FileA?

    Thanks...

    Dan

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Linked file questions (2000/XP/2003)

    Why do you start a second instance of Word? You can open more than one document in the running instance of Word.

  6. #6
    2 Star Lounger
    Join Date
    Sep 2002
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Linked file questions (2000/XP/2003)

    I'd like the work I'm doing on FileB to be in a different thread than FileA....Dan

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Linked file questions (2000/XP/2003)

    Why?

  8. #8
    2 Star Lounger
    Join Date
    Sep 2002
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Linked file questions (2000/XP/2003)

    Because the user is typing into FileA. For reasons that I can't understand, if FileB is in the same instance of Word, manipulating FileB (eg. saving, etc) while they are typing in FileA causes strange and annoying behavior for them.

    Dan

  9. #9
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Linked file questions (2000/XP/2003)

    I think you'll have to choose - either open both files in the same instance of Word, and be able to update the link, or open them in different instances, and lack the update feature (you'd have to save and close FileB, save and close FileA, then reopen FileA before you could update it.)

Posting Permissions

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