Breaking links on images in Word 2010 (not fields)

Anonymous
2014-11-12T18:49:40+00:00

I use Xpert Docs to create a word document from our Quote system and it will insert images of parts, etc...  When using the Alt-F9 it does change anything related to the image itself.  The process is I download it in the browser, open it I can see the images.  Then if I save it on my desktop or anywhere else it loses the linked images.  My solution was to try to create a macro to auto check the box of include image in document and then break the image link.  However all my attempts of usin VBA from prior searches focus on fields versus the image.  Can you provide assistance?  I do notice some issues where I can't physcially see the link/hyperlink itself -- when I check include images in document and NOT break the link only some of the images retain.

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
Answer accepted by question author
Paul Edstein 82,871 Reputation points Volunteer Moderator
2014-11-13T20:47:29+00:00

You can break the links by going to File>Edit Links to Files (in the lower-right corner), then selecting each link and choosing 'Break Link'. For a macro to automate the process, try:

Sub KillLinks()

' Turn Off Screen Updating temporarily.

Application.ScreenUpdating = False

Dim TrkStatus As Boolean, Pwd As String, pState As Boolean

Dim Rng As Range, Fld As Field, Shp As Shape, iShp As InlineShape

With ActiveDocument

  ' Insert your document's password between the double quotes on the next line

  Pwd = ""

  ' Initialise the protection state

  pState = False

  ' If the document is protected, unprotect it

  If .ProtectionType <> wdNoProtection Then

    ' Update the protection state

    pState = True

    ' Unprotect the document

    .Unprotect Pwd

  End If

  TrkStatus = .TrackRevisions

  .TrackRevisions = False

  ' Most of the work is done by this routine.

  For Each Rng In .StoryRanges

    ' Go through the shapes in the story range.

    For Each Shp In Rng.ShapeRange

      If Not Shp.LinkFormat Is Nothing Then Shp.LinkFormat.BreakLink

    Next Shp

    ' Go through the inlineshapes in the story range.

    For Each iShp In Rng.InlineShapes

      If Not iShp.LinkFormat Is Nothing Then iShp.LinkFormat.BreakLink

    Next iShp

    ' Go through the fields in the story range.

    For Each Fld In Rng.Fields

      If Not Fld.LinkFormat Is Nothing Then Fld.LinkFormat.BreakLink

    Next Fld

  Next Rng

  ' Restore original Track Changes status

  .TrackRevisions = TrkStatus

  ' If the document was protected, reprotect it, preserving any formfield contents

  If pState = True Then .Protect wdAllowOnlyFormFields, Noreset:=True, Password:=Pwd

  ' Set the saved status of the document to true, so that changes via

  ' this code are ignored. Since the same changes will be made the

  ' next time the document is opened, saving them doesn't matter.

  .Saved = True

End With

' Restore Screen Updating

Application.ScreenUpdating = True

End Sub

Was this answer helpful?

0 comments No comments

5 additional answers

Sort by: Most helpful
  1. Anonymous
    2014-12-09T15:51:46+00:00

    Hi Suzanne, 

    sorry, no does not work on my side, but converting the docx-file to the doc-format and then searching for INCLUDEPICTURE-Fields, selecting those and press CTRL + Shift + F9, works just well. 

    But actually this is not what I want, I want the built-in functionality in Word 2010 to work, but regrettably, this seems to be a bug which has not been addressed by Microsoft. I can run Paul Edstein's nice macro as a workaround in the meantime.

    I have been informed by our IT department that my Office 2010 is fully updated. 

    Nevertheless, thank you very much for your help. 

    Regards, Andreas

    Was this answer helpful?

    0 comments No comments
  2. Suzanne S Barnhill 279.8K Reputation points MVP Volunteer Moderator
    2014-12-09T13:16:56+00:00

    Does it not work to just select a picture and press Ctrl+Shift+F9?

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2014-12-09T12:57:09+00:00

    Hi Paul, 

    great this code works for me just fine, since the built-in functionality in Word 2010 (on docx-files) to break links just does not work: 

    The built in functionality I went along to break links:

     File Tab - Information - Edit Links to Files - Select Link(s) in the dialog field - Press 'Break Links'

    This built-in functionality of breaking links does definitely not work in Word 2010. I stand by this statement. Nothing happens. ----> Running your macro does the trick. Great job, Paul, thank you very much for your professional help. 

    I got another workaround in case I do not run your macro.

    • I change the docx file into a doc-file (97-2003).
    • Pressing Alt+F9 reveals the field codes. I can see my 'IncludePicture'-Fields.
    • Then Strg+H to bring up the Search and Replace Dialog Field
    • Search for IncludePicture Fields and break the link by pressing the shortcut STRG+Shift+F9

    Anyhow, is Microsoft aware that the built-in 'break link' functionality does not work on docx files in Word 2010. It would be great if they could patch it as soon as possible. 

    Paul, thank you very much again for your macro code

    Regards, Andreas

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2014-11-13T12:12:52+00:00

    Hi,

    Since you're using a Non-Microsoft software and need assistance in using VB script, you may also post this query in the following TechNet forum for better suggestion.

    http://social.technet.microsoft.com/Forums/en-US/home?forum=word  

    If you have any other queries related to Office products, feel free to reply and I'll be happy to further assist you.

    Thank you.

    Was this answer helpful?

    0 comments No comments