Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Illinois
    Posts
    551
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Break links from excel to word xp (Excel and word xp)

    I have a macro in Excel that opens a word document and updates the links. It is linked to the excel file. Then i do a "save as" of the word document and then i want to break the links in the word document. I can't figure out the code to do this, i looked in the help and it say to use this code...

    Sub BreakWordLinks()

    Dim shapeLoop As Shape
    For Each shapeLoop In ActiveDocument.Shapes
    With shapeLoop
    If .Type = msoLinkedOLEObject Then
    .LinkFormat.Update
    .LinkFormat.BreakLink
    End If
    End With
    Next shapeLoop

    End Sub

    but the word document contains excel objects which i don't think are "shapes".

    Anyway, can someone tell me the proper code to use an excel macro that is controlling word to break the word links to excel. thanks

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

    Re: Break links from excel to word xp (Excel and word xp)

    I don't have time for a complete solution now, but apart from floating shapes, other linked objects will actually be fields - if you display field codes, you will see { LINK ... }. You can unlink them all in one fell swoop by selecting the whole document and unlinking the fields. But this will also replace all other field codes by their values.

    Selection.WholeStory
    Selection.Fields.Unlink

    Another possibility is to display field codes, search for LINK fields by setting the search text to ^d LINK, and successively unlinking each found LINK field.

  3. #3
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Illinois
    Posts
    551
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Break links from excel to word xp (Excel and word xp)

    ok, that code worked. thanks for the help.

Posting Permissions

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