Refreshing Linked Picture

  • Thread starter Thread starter Rich
  • Start date Start date
R

Rich

Hi,

I have inserted a picture using VBA with

Shapes.AddPicture() and set the linked to Shapes.AddPicture and set the
linked parameter to msoTrue.

This causes the image to refresh whenever the workbook is opened.

1) How can I FORCE a refresh??

2) BTW, is there any way to insert a linked picture through the Excel GUI?

TIA
Rich
 
Hi Rich: Don't know how to refresh a link when it is in a Shape as the
container, but it can be done when it is in an OLEObject instead. To add it
you would use:
ActiveSheet.OLEObjects.Add Filename:="FilePath", Link:= True,
DisplayAsIcon:=False ' substitute your picture's file path for FilePath
Then to update the link it is just
ActiveSheet.OLDObjects(n).Update ' substitute the proper index for n

And to insert it through Excel's GUI, it is Insert... Object... Create From
File, then Browse for the file and check off the "link to file" checkbox
 
Thanks,

I gave it a go, but the image appears as a box with what text of what
appears to be a temp filename in it (eg A7563570.gif) rather than the actual
image.

I remember the same when I was first inserting through the GUI as you
suggest.

Any ideas??

Thanks
 
Excel is using your file associations to decide what kind of object it is,
and unfortunately does not handle .gifs too well there (it would depend on
your setup, but it makes it into a Photo Editor object on my machine, and I
get the blank box). You can try setting the file association to give you
different applications to use as the container object, but I can't say what
you might have that will work or how Excel will handle each app (can it
display the picture, or will it use the blank box?).

Does that picture need to be a .gif? It should work easily if you can
convert it (e.g. open it in Paint then Save As...) to a .bmp or .jpg, since
Excel does not seem to have the same trouble recognizing these.
 
Hmmm, sounds grave, want to be able to distribute the workbook, so playing
around with file types not an option.

It rips a graphic off my website, and I think that is the problem, because
the same behaviour is displayed for jpeg.

Bitmap displays but does not update properly.

I might try deleting and reinserting the linked image on a timer (or just
pull that function!)

Thanks for your help.

Rich
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top