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: 22,379
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
  #4  
Old 12-05-2024, 07:08 AM
RobbyD101 RobbyD101 is offline Add filename to embedded images Windows 11 Add filename to embedded images Office 2021
Novice
 
Join Date: Dec 2024
Posts: 2
RobbyD101 is on a distinguished road
Default I think this will do exactly what you asked.

I know it has been a couple of years since you ask this question, however I found this online posted which was actually posted 5 years ago which allows you to do exactly what you wanted to do. I was in the same boat so started Googling and found this thread first but kept looking and came across this video.

https://www.youtube.com/watch?v=crmEFyFcxac

I think you might have to re-add the images but you can try first.

Hope it works for you.
Reply With Quote
  #5  
Old 12-05-2024, 01:17 PM
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: 22,379
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

The topic discussed in this thread concerns the retrieval of filenames for images already embedded in the document, which is not possible. If you want to insert multiple images, there is a much more sophisticated approach in the Automate the Insertion of Multiple Images into a Document 'Sticky' thread at the top of the Drawing and Graphics forum: https://www.msofficeforums.com/drawi...-document.html
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #6  
Old 12-05-2024, 01:22 PM
RobbyD101 RobbyD101 is offline Add filename to embedded images Windows 11 Add filename to embedded images Office 2021
Novice
 
Join Date: Dec 2024
Posts: 2
RobbyD101 is on a distinguished road
Default

Thanks macropod.
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 11:54 AM.


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