Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-21-2022, 12:56 AM
pulleng pulleng is offline Add filename to embedded images Windows 10 Add filename to embedded images Office 2016
Novice
Add filename to embedded images
 
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
  #2  
Old 07-21-2022, 08:30 AM
macropod's Avatar
macropod macropod is offline Add filename to embedded images Windows 10 Add filename to embedded images Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by pulleng View Post
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
There is nothing stored in a Word document that can tell you the original name of an embedded image; only the names of linked images can be retrieved.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 07-21-2022, 10:35 AM
pulleng pulleng is offline Add filename to embedded images Windows 10 Add filename to embedded images Office 2016
Novice
Add filename to embedded images
 
Join Date: Jul 2022
Posts: 2
pulleng is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
There is nothing stored in a Word document that can tell you the original name of an embedded image; only the names of linked images can be retrieved.
As I feared, what a damn shame, oh well I will have to do it manually then.
Reply With Quote
Reply

Tags
vba, word vba



Similar Threads
Thread Thread Starter Forum Replies Last Post
Add filename to embedded images Insert multiple images in table with filename in column to the side Kass Word VBA 2 05-03-2018 08:14 AM
Extract embedded images and save according to hyperlink. PRA007 Word VBA 2 02-05-2016 01:46 AM
Add filename to embedded images How do i include embedded images in a mail-merge? Hindmost Mail Merge 14 09-18-2015 02:01 PM
Source code for embedded images whitland Outlook 0 09-06-2011 03:59 AM
simple way to save embedded images? Newmarket2 Drawing and Graphics 0 03-12-2010 12:24 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:30 AM.


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