小さなサブルーチンを使用して、シートに画像を挿入しました
ActiveSheet.Pictures.Insert(URL).Select
これは Excel 2003 (Windows) では正常に機能しますが、Excel 2011 (Mac) では機能しなくなりました。
したがって、サブルーチンを変更しました(提案されたhttp://www.launchexcel.com/google-maps-excel-demo/のように)が、サブルーチンは次の場所で停止します
theShape.Fill.UserPicture URL
エラーメッセージ付き
"-2147024894 (80070002) Fehler der Methode UserPicture des Objects FillFormat"
長方形は緑色です!
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
提案やヒントはありますか?おそらく私はコウモリのように盲目です....