How do I convert embedded images to linked images in Word 2007

I have a very large Word document. It is created by copying a large HTML page from Chrome and pasting it into Word. Works great. All of the images displayed in the HTML page are in two directories. For example, the <img> tags might look like this:
<img src="../my/images/dir_1/Picture1.jpg">
<img src="../my/images/dir_2/PictureA.jpg">

When I create the Word file by pasting from the browser, the images are all embedded in the .docx. Since one image might appear even 500 times in the document, I'd like to try having the images linked instead of embedded, to hold down the size of the .docx file. How do I make that happen? I'm familiar with writing macros, but not for a task like this.

Thanks for any help.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Can you post a small sample portion of the document, please, so that we can be sure what we are dealing with?
StevenMilesAuthor Commented:
Sure. Here's a sliver:

I'm embarrassed to report that the full document is hundreds of megabytes.
Officially, there is no pointer in an embedded picture to its original file. However, it looks as if the default value for the AlternativeText property is the filename. One complication is that, in the document that you provided, the property shows the full filename. In my attempt to reproduce the situation here, only the filename appears. The path is omitted. Therefore this macro allows  for a default path which is used if no path is found in the name.
Sub ChangeToLink()
Dim ilsh As InlineShape
Dim strFileName As String
Dim rng As Range
Dim bFound As Boolean
Dim strPicturesFolder As String

strPicturesFolder = "C:\MyPictures\"
    bFound = False
    For Each ilsh In ActiveDocument.InlineShapes
        Set rng = ilsh.Range
        strFileName = ilsh.AlternativeText
        Debug.Print "1", strFileName
        If Len(strFileName) > 0 Then
            If ilsh.LinkFormat Is Nothing Then
                If InStr("\", strFileName) = 0 Then
                    strFileName = strPicturesFolders & strFileName
                End If
                ActiveDocument.InlineShapes.AddPicture strFileName, True, False, rng
                bFound = True
                Exit For
            End If
        End If
    Next ilsh
Loop While bFound
End Sub

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
StevenMilesAuthor Commented:
Hmm. Very interesting Graham. Not really what I was looking for, but maybe I can use it on another project.

For the current problem, I found a workaround. Thanks
Can you give us an idea of what the workaround is, please?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Word

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.