![]() |
|
#3
|
||||
|
||||
|
The following macro will insert a linked thumbnail image at the cursor, subject to the provisos mentioned by Andrew. Call it from a macro that provides the image path and optionally the screen tip text.
Code:
Sub InsThumbNail(strPath As String, _
Optional strTipText As String = "Link to full size image")
'Graham Mayor - http://www.gmayor.com - Last updated - 20 May 2018
Dim oShape As InlineShape
Set oShape = Selection.InlineShapes.AddPicture(FileName:=strPath, _
LinkToFile:=False, _
SaveWithDocument:=True)
With oShape
.LockAspectRatio = msoTrue
.Width = InchesToPoints(1)
ActiveDocument.Hyperlinks.Add Anchor:=.Range, _
Address:=strPath, _
SubAddress:="", _
ScreenTip:=strTipText, _
TextToDisplay:=.Range.Text
End With
lbl_Exit:
Set oShape = Nothing
Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Picture content control -> insert picture -> empty?
|
Jaymond Flurrie | Word | 3 | 07-13-2016 07:00 AM |
How do I insert pictures directly into picture boxes by clicking the box instead of using INSERT>PIC
|
Bree | Word | 1 | 06-24-2016 10:32 PM |
Error message opening a document in Word "Word cannot open this file because it is larger than 512 M
|
poonamshedge | Word | 2 | 09-11-2014 06:11 AM |
"Insert Picture\Link to File..." embeds picture
|
sinz54 | Drawing and Graphics | 1 | 09-29-2013 06:31 PM |
| Can i insert a thumbnail image, but expand it during my presentation? | deejaycruiser | PowerPoint | 1 | 11-10-2010 11:13 AM |