![]() |
Image File Path for Linked Pictures
I am trying to return the full source path of image files for linked images
in an Excel spreadsheet (msoLinkedPicture). The following code does not work, but it demonstrates what I am trying to do. Dim oShape As Shape For Each oShape In ActiveSheet.Shapes If oShape.Type = msoLinkedPicture Then Debug.Print oShape.LinkFormat.SourceFullName End If Next Does anyone happen to know how to return a linked picture's source name? |
Image File Path for Linked Pictures
I got the name a little different than you were trying. I added awatch to
oshape and then open it up and started searching for the path. Sub xyz() Dim oShape As Shape For Each oShape In ActiveSheet.Shapes 'If oShape.Type = msoLinkedPicture Then abc = oShape.OLEFormat.Object.SourceName Debug.Print oShape.OLEFormat.Object.SourceName 'End If Next End Sub "Lazzaroni" wrote: I am trying to return the full source path of image files for linked images in an Excel spreadsheet (msoLinkedPicture). The following code does not work, but it demonstrates what I am trying to do. Dim oShape As Shape For Each oShape In ActiveSheet.Shapes If oShape.Type = msoLinkedPicture Then Debug.Print oShape.LinkFormat.SourceFullName End If Next Does anyone happen to know how to return a linked picture's source name? |
Image File Path for Linked Pictures
How did you create your linked picture ?
NickHK "Lazzaroni" wrote in message ... I am trying to return the full source path of image files for linked images in an Excel spreadsheet (msoLinkedPicture). The following code does not work, but it demonstrates what I am trying to do. Dim oShape As Shape For Each oShape In ActiveSheet.Shapes If oShape.Type = msoLinkedPicture Then Debug.Print oShape.LinkFormat.SourceFullName End If Next Does anyone happen to know how to return a linked picture's source name? |
Image File Path for Linked Pictures
Nick:
Good question. I wonder if my problems have something to do with the way I am creating the image object. I use the following code: Dim oPicture As Object Dim sFilename As String Set oPicture = ActiveSheet.Shapes.AddPicture(sFilename, msoTrue, msoFalse, 10, 10, 100, 100) The images work fine and are definitely linked. If I delete the external file, the image breaks when I restart Excel. ActiveSheet.Shapes("Picture 1").Type returns msoLinkedPicture. I tried finding an object to return the path of the linked image file, but the best I could do was: ActiveSheet.Shapes("Picture 1").LinkFormat.SourceName But that just returns the following error: "Object doesn't support this property or method." Joel's suggestion didn't work for me either. Thank you for your help. |
All times are GMT +1. The time now is 08:07 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com