用vb6 如何把显示的图片放入Excel指定的表格中
用vb6 如何把显示的图片放入Excel2007指定的表格中?如显示的图片的控件名是picture1,要放到Excel2007的sheet1的D10单元格内。
用xlsheet.Cells(10, 4) = Picture1显示出来的是一串数字,不知道是什么意思。我要的是显示的图片
用xlsheet.Cells(10, 4) = Picture1.picture,但是报错
Excel Visual?Basic?6.0 图片 控件
[解决办法]
没见过单元值能为图片,只能是粘贴(插入)图片。
Clipboard.Clear
Clipboard.SetData Picture1.Picture
xlsheet.Range("A1").Select
xlsheet.PasteSpecial Format:="位图", Link:=False, DisplayAsIcon:=False
Sub 插入图片() '调整单元格大小,以适应图片大小
On Error Resume Next
With CreateObject("internetexplorer.application")
.Visible = False
.Navigate "http://www.baidu.com/"
Do Until .ReadyState = 4
DoEvents
Loop
Set a = .document.All.tags("img")(0)
Cells(10, "d").RowHeight = a.Height * 0.75
Cells(10, "d").ColumnWidth = a.Width * 0.1226
ML = Cells(10, "d").Left
MT = Cells(10, "d").Top
MW = Cells(10, "d").Width
MH = Cells(10, "d").Height
Cells(10, "d").Select
ActiveSheet.Shapes.AddShape(msoShapeRectangle, ML, MT, MW, MH).Select
Selection.ShapeRange.Fill.UserPicture a.href
Selection.ShapeRange.Line.Visible = False
.Quit
End With
End Sub