Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-02-2017, 02:54 AM
amdv amdv is offline Hyperlink to image in folder Windows 8 Hyperlink to image in folder Office 2010 64bit
Novice
Hyperlink to image in folder
 
Join Date: Oct 2017
Posts: 1
amdv is on a distinguished road
Default Hyperlink to image in folder

Hello,



I was wondering whether I can create the following macro:

I have a number of images in a Word 2010 document. I'd like to assign each image a hyperlink that would open the respective image in its folder location (on following the hyperlink). So perhaps the macro would need to recognise each image's name/location to determine what hyperlink to use.

To clarify, the point is that it'd easier to find the original full-size image in a folder containing a lot of images fast, and without having to rely on the image caption being the same as the image name in the folder location.

Please let me know if this is unclear.
Thanks!
Reply With Quote
  #2  
Old 11-04-2017, 01:27 AM
FionaMcKenzie FionaMcKenzie is offline Hyperlink to image in folder Windows 10 Hyperlink to image in folder Office 2016
Novice
 
Join Date: Oct 2017
Location: Surrey, United Kingdom
Posts: 14
FionaMcKenzie is on a distinguished road
Default

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
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Hyperlink to image in folder Hyperlink Text to an Image in Word Franklin Drawing and Graphics 8 09-19-2015 02:14 PM
How do I add a hyperlink to an image? sarahrb PowerPoint 1 08-26-2012 08:26 AM
Hyperlink to image in folder Putting an image with hyperlink to certain slides spiffmonkey1 PowerPoint 1 07-17-2011 03:58 PM
Hyperlink to image in folder Adding Image into a excel cell and adding a hyperlink to the image saravananiyyanar Excel 3 05-04-2011 08:31 AM
Outlook and folder hyperlink RalphConnor Outlook 0 02-28-2011 12:23 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:45 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft