Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 55
Default Get Path for Linked Pictures in Spreadsheet

Does anyone know how to return the full path of the file to which a linked
picture in Excel points to?

I use the following code to insert images into my sheet:

Set oPicture = ActiveSheet.Shapes.AddPicture(sFilename, LinkToFile:=msoTrue,
SaveWithDocument:=msoFalse, 10, 10, 100, 100)

I need to be able to get the filename of the picture that Excel is linking
to after images have been inserted into a spreadsheet.

Thank you for your help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Get Path for Linked Pictures in Spreadsheet

Having a quick look at this now, I find:

- Using Shapes.AddPicture, the EditLinks is greyed out and OleObjects.Count
=0. Not surprising really, as you are not using the OLEObjects collection.
It seems then that Excel handles the linking without exposing the link's
properties.

- Using
Dim NewOLE As OLEObject
Set NewOLE = ActiveSheet.OLEObjects.Add(Filename:="C:\Sample.jp g",
Link:=True, DisplayAsIcon:=False)

I could initially only get a Package to diplay, not the graphic. After
reading:
http://support.microsoft.com/kb/903177
and installing Photo Editor, I now get a white rectangle, the size of the
graphic, but not the graphic itself. Activating the graphic, I can see it in
MS Photo Editor. If you can fix that, you should be OK.

Now that you actually have an OLEObject, you can check each one. Note that
you need error handling (or some method to check the type of OLEObject) as
not all OLEObjects will have a .SourceName property.

Private Sub CommandButton2_Click()
Dim OLEObj As OLEObject

On Error Resume Next
For Each OLEObj In Worksheets(1).OLEObjects
Debug.Print OLEObj.SourceName
Next

End Sub

NickHK

"Lazzaroni" wrote in message
...
Does anyone know how to return the full path of the file to which a linked
picture in Excel points to?

I use the following code to insert images into my sheet:

Set oPicture = ActiveSheet.Shapes.AddPicture(sFilename,

LinkToFile:=msoTrue,
SaveWithDocument:=msoFalse, 10, 10, 100, 100)

I need to be able to get the filename of the picture that Excel is linking
to after images have been inserted into a spreadsheet.

Thank you for your help.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 55
Default Get Path for Linked Pictures in Spreadsheet

Nick:

I was able to retrieve the SourceName when I insert the image as a linked
OLEObject, but as you said, linked OLEObject images do not display correctly,
even after I installed Photo Editor.

Even if I could get the image to display correctly, I dont know that I
would use OLEObjects. It was a simple matter for me to install Photo Editor
on my test computer, but it would be another matter altogether to install it
on all of the computers that use my software, because some of them are
permanently in overseas locations.

Its really unfortunate that there is no way to acquire the source name for
ShapeType msoLinkedPicture objects. That information must be stored somewhere
in the document. If only I could get to it.

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
Image File Path for Linked Pictures Lazzaroni Excel Programming 3 March 28th 07 03:44 PM
Are pictures in headers embedded or linked? Debbie Excel Discussion (Misc queries) 1 November 4th 06 11:06 PM
How can I replace the path of the linked spreadsheet in a cell? Norm Excel Worksheet Functions 2 July 30th 05 06:26 AM
linked pictures in Excel sergiu Charts and Charting in Excel 0 June 28th 05 09:52 PM
default path for pictures Wazooli Excel Discussion (Misc queries) 0 February 28th 05 06:43 PM


All times are GMT +1. The time now is 07:44 AM.

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

About Us

"It's about Microsoft Excel"