I lately converted a microsoft office Word file (docx) to a pdf file, to find out that once you put the cursor over certain images, you can see the original path of the image imported in the word document, as it is shown in the image below :

enter image description here

How can you remove this path from the docx file so that once converted to a pdf it doesn't display the path ?


URL HERE : Original Thread

This Question was originally asked by : Sergey SPb

Whenever an object (e.g. an external image) is inserted from an ext. file into the MS Word document, the Word automatically stores the file path as a hidden "alternative text" of the image object.

Depending on the context, this functionality might strongly violate the user's privacy and data confidentiality, because the third person receiving the document (e.g. for editorial postprocessing) will see the full paths to the images included in this document, which, again depending on the context, might contain sensitive information.

This alt. text can only be removed manually for each object in "Format Figure..." \ "Alt Text" \ "Description". For large documents with hundreds of figures, the probability of a human mistake is very high.

Can this functionality be turned off by some option?

I mean, can the external image file be somehow inserted into MS Word document so that the file path is NOT stored in alternative text field?

And the best answer was given by : macropod :

there's no way to turn 'off' the behaviour. You could use a macro like:

    Sub KillAltText()
    Application.ScreenUpdating = False
    Dim Rng As Range, Shp As Shape, iShp As InlineShape
    With ActiveDocument
      For Each Rng In .StoryRanges
        With Rng
          For Each Shp In .ShapeRange
            Shp.AlternativeText = ""
          For Each iShp In .InlineShapes
            iShp.AlternativeText = ""
        End With
    End With
    Application.ScreenUpdating = True
    MsgBox "Finished updating", vbOKOnly
    End Sub

I personally tested this script and it works, and i thought of sharing it in StackOverflow.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.