3

I am working on an MS Excel workbook that contains around 200 images. They are currently saved within the workbook, so the file becomes huge and working gets very slow.

Linking the pictures without saving them works very well -- I now have the Excel document and a folder "pictures" next to it that contains all my image files.

However, when I move the document and the folder to a new location, all my pictures disappear. This seems to be because Excel saves the link information as absolute paths. (Update: Actually, according to this thread, Excel stores the link information as relative paths as well. Now I really don't know why my links break down..)

Is there a convenient way to save them as relative paths or have Excel automatically update the path information?

Update: It's important that the images get displayed on the sheet and can be printed.

I am working with Microsoft Excel for Mac 2008 and 2011. I really appreciate your help.

  • Please do a bit of research before posting: See [here](http://office.microsoft.com/en-gb/excel-help/create-select-edit-or-delete-a-hyperlink-HP010342381.aspx) and [here](http://www.excelforum.com/excel-programming-vba-macros/335099-force-relative-path-in-insert-hyperlink-dialog.html) for answers. – zx8754 Jun 25 '13 at 08:20
  • 1
    I did read about this and tried it out yesterday. The problem is that when I add a hyperlink to an image file instead of an image file as a link, the image won't get _displayed_ in my Excel sheet. I need to be able to view the images in my sheet and print them. –  Jun 25 '13 at 08:31
  • Related: https://superuser.com/q/876356/234848 – Hugh Feb 23 '18 at 10:16

2 Answers2

0

You have 2 basic questions here, rendering images in Excel, and relative paths.

Rendering Images in Excel

There's a script to accomplish this on SO:

Dim url_column As Range
Dim image_column As Range

Set url_column = Worksheets(1).UsedRange.Columns("A")
Set image_column = Worksheets(1).UsedRange.Columns("B")

Dim i As Long
For i = 1 To url_column.Cells.Count

  With image_column.Worksheet.Pictures.Insert(url_column.Cells(i).Value)
    .Left = image_column.Cells(i).Left
    .Top = image_column.Cells(i).Top
    image_column.Cells(i).EntireRow.RowHeight = .Height
  End With

Next

Relative Paths

I don't know of a way to specify relative paths in an Excel doc, but there's an easy workaround for this. Create a folder for you Excel doc and all of the supporting images, and keep them together. If you need to move this to another location, you just move the whole folder. This also makes it easy to zip up & send to others.

Lenwood
  • 383
  • 2
  • 8
  • 2
    Thank you for your reply. Your suggestion for the relative path issue would be great, but this is exactly what I can't get to work. I read on SO that linked files are actually saved relatively as well (http://superuser.com/questions/394270/are-excel-linked-paths-relative-or-absolute), but whenever I move or rename the whole folder with excel doc and images, the links are all broken. What am I doing wrong? – Port Islander 2009 Jun 27 '13 at 09:25
  • I see the same thing. This would work only for a simple case, but duplicating the folder will not preserve the relative paths, they will randomly point to the older directory. – Joe May 07 '20 at 06:33
0

Use the Find/Replace feature in Excel to update the path of your image file. I moved my files from /Desktop to /Dropbox. I replaced "desktop" with "dropbox" and within seconds, all my image paths updated. :)