#1
|
|||
|
|||
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! |
#2
|
|||
|
|||
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 |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
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 |
Putting an image with hyperlink to certain slides | spiffmonkey1 | PowerPoint | 1 | 07-17-2011 03:58 PM |
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 |