You are on page 1of 2

English

Method 2: Batch Remove Hyperlinks from All Pictures in a


Document
There is the way to remove all hyperlinks from a document. First you press “Ctrl+ A” to select all contents. Then you
press “Ctrl+ Shift+ F9” to kill all hyperlinks. For your information, this way clears all hyperlinks both on pictures and
texts. Yet, our aim is to remove hyperlinks from pictures only. So we will have to utilize a macro to finish the job.

1. First of all, press “Alt+ F11” to trigger the VBA editor in Word.

2. Then in the editor, click on “Normal” project.


3. Next on the menu bar, click “Insert”.
4. And choose “Module” on the drop-down menu.

5. Now double click on the module to open its coding area on the right and paste the following macro there:

Sub RemoveAllHyperlinksFromPicturesInOneDocument()
Dim objInlinePicture As InlineShape
Dim objPicture As Shape

If ActiveDocument.InlineShapes.Count > 0 Then


For Each objInlinePicture In ActiveDocument.InlineShapes
objInlinePicture.Select

While Selection.Hyperlinks.Count > 0


Selection.Hyperlinks(1).Delete
Wend
Next
End If

If ActiveDocument.Shapes.Count > 0 Then


For Each objPicture In ActiveDocument.Shapes
objPicture.Select

While Selection.Hyperlinks.Count > 0


Selection.Hyperlinks(1).Delete
Wend
Next
End If
End Sub

6. Last but not the least, click “Run” on menu bar to execute codes.
Method 3: Batch Remove Hyperlinks from Pictures in Multiple English

Documents
1. Before all, arrange all target documents in one folder.
2. Then repeat steps in method 2 to install and run the following macro:

Sub RemoveAllHyperlinksFromPicturesInMultipleDocuments()
Dim objInlinePicture As InlineShape
Dim objPicture As Shape
Dim StrFolder As String
Dim strFile As String
Dim objDoc As Document
Dim dlgFile As FileDialog

Set dlgFile = Application.FileDialog(msoFileDialogFolderPicker)

With dlgFile
If .Show = -1 Then
StrFolder = .SelectedItems(1) & "\"
Else
MsgBox ("No Folder is selected!")
Exit Sub
End If
End With

strFile = Dir(StrFolder & "*.doc*", vbNormal)

While strFile <> ""


Set objDoc = Documents.Open(FileName:=StrFolder & strFile)
Set objDoc = ActiveDocument

If ActiveDocument.InlineShapes.Count > 0 Then


For Each objInlinePicture In ActiveDocument.InlineShapes
objInlinePicture.Select
While Selection.Hyperlinks.Count > 0
Selection.Hyperlinks(1).Delete
Wend
Next
End If

If ActiveDocument.Shapes.Count > 0 Then


For Each objPicture In ActiveDocument.Shapes
objPicture.Select
While Selection.Hyperlinks.Count > 0
Selection.Hyperlinks(1).Delete
Wend
Next
End If

objDoc.ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
objDoc.Save
strFile = Dir()
Wend
End Sub

3. In the “Browse” window open, pick the folder you set in step 1 and click “OK” to move on.

Be Cautious about Your Operation in Word


Word is not foolproof, so any wrong operation may easily trigger the collapse or worse, resulting document corruption.
While you can pay more attention to your operation skills and habits, you can also purchase a utility for doc recovery
beforehand.

You might also like