Results 1 to 5 of 5

Thread: Add a picture from the web using vba

  1. #1

    Add a picture from the web using vba

    When I run this code to add a picture in office 2007, I cant get excel vba to add a picture from the web. If it is a local picture this code works fine. It also seems to work fine on prior versions of office. Anyone run into this before?

    [VBA]Dim p As Object
    Set p = ActiveSheet.Pictures.Insert("F:\myimage.jpg")

  2. #2
    Hmm you might just need to fully declare your url. This works fine for me:[vba]Sub test()
    Dim p As Excel.Picture
    Set p = ActiveSheet.Pictures.Insert(_
    End Sub
    [/vba](Note you can dim as object too if you like, but there is no real need to do latebinding in this instance.)

  3. #3

    VBA web link

    Just out of curiosity, what version of office/excel are you trying this on? Your code and the one I posted earlier will work on anything but my laptop, which happens to be running Office 2007. I have tried using the macro recorder to see what office 2007 provides for code, but it does not provide any code when adding or changing images...

  4. #4
    Works on 97 & 2003.

  5. #5

    VBA web link

    Anyone try it in office 2007, or know why it won't work in office 2007. Im running into a wall trying to figure out what I have to do. At this point I added a web browser control to show the picture. This does not seem like an efficient way to do it...

Posting Permissions

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