Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 55
Default 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?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default 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?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default 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?



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 55
Default 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.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Formula too long - new file path is shorter than old file path - Excel 2003 Greg J Excel Worksheet Functions 1 November 22nd 06 05:16 PM
Loading Pictures in Image box Troubled User Excel Programming 5 January 15th 06 03:02 AM
Linked file in same folder but unknown path Christy Excel Programming 6 October 4th 05 06:30 PM
default path for pictures Wazooli Excel Discussion (Misc queries) 0 February 28th 05 06:43 PM
Copy and Paste Formula Without the linked file path KevinB Excel Worksheet Functions 2 January 20th 05 06:45 PM


All times are GMT +1. The time now is 08:41 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"