Hi there,
I hope I have understood your question? Does the following code do what you want?
Option Explicit
Public Sub HyperlinkedPicture()
Dim oInlineShape As Word.InlineShape
Dim sFileFullName As String
Dim oFileBrowse As FileDialog
Set oFileBrowse = Application.FileDialog(msoFileDialogFilePicker)
With oFileBrowse
.Title = "Insert Picture"
.AllowMultiSelect = False
.ButtonName = "Insert and Hyperlink"
.Filters.Clear
.Filters.Add "Pictures", "*.jpg, *.jpeg, *.wmf, *.emf, *.gif"
If .Show Then
sFileFullName = .SelectedItems(1)
Set oInlineShape = Selection.InlineShapes.AddPicture _
(FileName:=sFileFullName, LinkToFile:=True, SaveWithDocument:=False)
ActiveDocument.Hyperlinks.Add Anchor:=oInlineShape.Range, _
Address:=sFileFullName
End If
End With
Set oInlineShape = Nothing
Set oFileBrowse = Nothing
End Sub
|