这对我有用:
Sub sof20301212ShapesAddpicture()
Dim strPath
Dim p As Object
strpath = "http://www.google.com/images/srpr/logo11w.png"
Set p = ActiveSheet.Shapes.AddPicture(strPath, msoCTrue, msoTrue, 100, 100, 86, 129)
End Sub
参考Shapes.AddPicture method:
'Declaration
FunctionAddPicture ( _
Filename As String, _
LinkToFile As MsoTriState, _
SaveWithDocument As MsoTriState, _
LeftAsSingle, _
TopAsSingle, _
WidthAsSingle, _
HeightAsSingle _
) AsShape
Filename: The file from which the OLE object is to be created.
LinkToFile: Microsoft.Office.Core.MsoTriState
The file to link to. Can be one of these MsoTriState constants:
msoCTrue
msoFalse To make the picture an independent copy of the file.
msoTriStateMixed
msoTriStateToggle
msoTrue To link the picture to the file from which it was created.
SaveWithDocument
Type: Microsoft.Office.Core.MsoTriState
Required MsoTriState. To save the picture with the document.
LinkToFile 和 SaveWithDocument 不能同时为 false,因为无处保存图像。
LinkToFile 和 SaveWithDocument 对可以是:
true, true
true, false
false, true