View Single Post
 
Old 07-21-2022, 12:56 AM
pulleng pulleng is offline Windows 10 Office 2016
Novice
 
Join Date: Jul 2022
Posts: 2
pulleng is on a distinguished road
Question Add filename to embedded images

I have a word file that has images embedded. I want to add a caption below each image to show the filename. I know how to loop through the images and add a caption (code below) but how can I find the original file name please?

Code:
Option Explicit
Sub Example1()
Dim intCount As Integer
Dim i As Integer
For i = 1 To InlineShapes.Count
    'check if the current shape is a picture
    If InlineShapes.Item(i).Type = _
        wdInlineShapePicture Then
        'select the picture
        InlineShapes.Item(i).Select
        'assign a caption to it
        Selection.InsertCaption Label:="Figure", _
           Title:="WHERE DO I FIND THE FIENAME TO ADD?", _
           Position:=wdCaptionPositionBelow
    End If
Next i
End Sub
Reply With Quote