Results 1 to 4 of 4

Thread: Picture Links

  1. #1
    Star Lounger
    Join Date
    Feb 2001
    Location
    Virginia Beach, Virginia, USA
    Posts
    80
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Picture Links

    Is there any way to programmatically change the cell that a picture link is pointing to?
    I have tried similar to (from recording a macro):
    ActiveSheet.Shapes("Picture 9").select
    Selection.Formula = "$BC$139"
    Range("A1").Select
    but all it does is select the picture. It does not update the formula nor does select the cell.

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Picture Links

    I don't think it is possible to access the properties of a Picture Link. The only thing I could suggest would be to delete your existing picture object and create a new one via VBA based on the selection you require. It is important that you rename the new picture so that you can access it, as if is created dynamically via VBA you will not know how to reference it, unless you name it. You could probably reuse the same name if you delete the earlier version before creating the update. (Activesheet.Shapes("Picture X").Name = "MyPic")

    Record a macro creating the picture link you want just to get the syntax, as it varies depending on what options you select. When recording the macro, do not use the camera tool, but instead Shift-Edit and Copy Picture, and when you want to paste use the Shift_Edit and Paste Picture. You could turn off screen updating whilst all this is taking place, and it should appear ok.

    Hope that can help you.

    Andrew C

  3. #3
    5 Star Lounger
    Join Date
    Dec 2000
    Location
    Reading/Swindon, Berkshire, United Kingdom
    Posts
    664
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Picture Links

    Do you need this to be done programatically? what you're after can be done without vba. In case you're interested, define the name ChoosePic as "=IF(AA1=1,AB$1:$AE$10,$AB$11:$AE$20)" (where you've got interesting stuff in those areas) and then insert a picture box and type =ChoosePic in it. This should do the trick, though this is from memory. I seem to recall it won't work without the extra step of the named range.

    Brooke

  4. #4
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Picture Links

    Actually as Brooke points out, it can be done provided the range you want in the formula is named. So you could name the range and have Selection.Formula = "RangeName", instead of the actual range address, and that should work fine.

    Andrew C

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •