Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8456101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:27:38+00:00 2026-06-10T12:27:38+00:00

I’ve used a small subroutine to insert a picture into my sheet by ActiveSheet.Pictures.Insert(URL).Select

  • 0

I’ve used a small subroutine to insert a picture into my sheet by

ActiveSheet.Pictures.Insert(URL).Select

This works fine with Excel 2003 (Windows), but does not work with Excel 2011 (Mac) any more.

Therefore I modified my subroutine
(like proposed http://www.launchexcel.com/google-maps-excel-demo/),
but the subroutine stops at

theShape.Fill.UserPicture URL 

with the error message

“-2147024894 (80070002) Fehler der Methode UserPicture des Objekts FillFormat”

The rectangle is green!

Sub Q1()

Dim wks As Worksheet
Dim URL As String
Dim i As Long
Dim lastRow As Long
Dim theShape As Shape
Dim pasteCell As Range

' Used Worksheet
Set wks = Worksheets("Blatt1")

' Delete already existing shapes
For Each theShape In wks.Shapes
        theShape.Delete
Next theShape

' Check all existing rows in Column K
lastRow = Cells(Rows.Count, "K").End(xlUp).Row
For i = 2 To lastRow

' the URLs are already computed and stored in column K
URL = wks.Range("K" & i).Value

' try to put the images in column L
Set pasteCell = wks.Range("L" & i)
pasteCell.Select

' Create a Shape for putting the Image into
' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!!
Set theShape = wks.Shapes.AddShape(msoShapeRectangle, pasteCell.Left, pasteCell.Top, 200, 200)

' fill the shape with the image after greening
theShape.Fill.BackColor.RGB = RGB(0, 255, 0)
theShape.Fill.UserPicture URL

Next i

End Sub

Any suggestions or hints? Probably I’m blind as a bat….

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T12:27:39+00:00Added an answer on June 10, 2026 at 12:27 pm

    Have you tried syntax along the lines of this for setting a shape to a URL:

    Sub Picadder()
    
    Dim Pic As Shape
    
    Set Pic = ActiveSheet.Shapes.AddPicture("http://stackoverflow.com/content/stackoverflow/img/apple-touch-icon.png", msoFalse, msoTrue, 0, 0, 100, 100)
    
    End Sub
    

    This code, when adapted to your efforts, might look something along the lines of this:

    Sub Q1()
    
    Dim wks As Worksheet
    Dim URL As String
    Dim i As Long
    Dim lastRow As Long
    Dim theShape As Shape
    Dim pasteCell As Range
    
    ' Used Worksheet
    Set wks = Worksheets("Blatt1")
    
    ' Delete already existing shapes
    For Each theShape In wks.Shapes
            theShape.Delete
    Next theShape
    
    ' Check all existing rows in Column K
    lastRow = Cells(Rows.Count, "K").End(xlUp).Row
    For i = 2 To lastRow
    
    ' the URLs are already computed and stored in column K
    URL = wks.Range("K" & i).Value
    
    ' try to put the images in column L
    Set pasteCell = wks.Range("L" & i)
    pasteCell.Select
    
    ' Create a Shape for putting the Image into
    ' ActiveSheet.Pictures.Insert(URL).Select is deprecated and does not work any more!!!
    Set theShape = wks.Shapes.AddPicture(URL, pasteCell.Left, pasteCell.Top, 200, 200)
    
    ' Set shape image backcolor.
    theShape.Fill.BackColor.RGB = RGB(0, 255, 0)
    
    Next i
    
    End Sub
    

    Your urls will need to be properly formatted – I had to use quotations on my URL for the initial snippet to get it function effectively, but it may be a solution.

    For Mac-Excel 2011, there is a workaround discussed by Michael McLaughlin on his blog. Evidently, it is not easy to tie images to cells in Mac-Excel 2011, if at all. Moreover, research reveals that the question of inserting images into an excel workbook has been asked many times. It also appears that it has not been readily solved through picture methods thus far in the research. Thus, a work-around may be the best solution.

    The code snippet, which was very closely adapted and ported from Michael’s blog, is as follows:

    Function InsertImageCommentAsWorkAround(title As String, cellAddress As Range)
    
        ' Define variables used in the comment.
        Dim ImageCommentContainer As comment
    
      ' Clear any existing comments before adding new ones.
      Application.ActiveCell.ClearComments
    
      ' Define the comment as a local variable and assign the file name from the _
      ' _ cellAddress as an input parameter to the comment of a cell at its cellAddress.
    
      ' Add a comment.
      Set ImageCommentContainer = Application.ActiveCell.AddComment
    
      ' With the comment, set parameters.
      With ImageCommentContainer
        .Text Text:=""
    
            'With the shape overlaying the comment, set parameters.
            With .Shape
              .Fill.UserPicture (cellAddress.Value)
              .ScaleHeight 3#, msoFalse, msoScaleFormTopLeft
              .ScaleWidth 2.4, msoFalse, msoScaleFromTopLeft
            End With
    
      End With
    
      InsertImageCommentAsWorkAround = title
    
    End Function
    

    I would advise adapting the comment sets into your loop, and use that to set your images into place, using the shape formatting in your loop to set the formatting of the comment shapes generated by the adapted code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I used javascript for loading a picture on my website depending on which small
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
For some reason, after submitting a string like this Jack’s Spindle from a text
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
This could be a duplicate question, but I have no idea what search terms

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.