将图片插入到Excel VBA中,方法图片失败 [英] Insert picture to Excel VBA, method Pictures failed
本文介绍了将图片插入到Excel VBA中,方法图片失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
试图制作一个在Excel中逐渐插入3个图像的宏
一个工作表(图片)包含A列第1-3行中的图像的URL
其他工作表(输出)应该水平输出图像。
Sub testinsertpix()
Dim i As Integer
Dim link As String
For i = 1 To 3
link = Worksheets(pics)。Cells ,A)。值
单元格(1,i)。选择
ActiveSheet.Pictures.Insert(link)
下一步i
结束Sub
它插入第一个图像,但是当循环到达第二个图片时失败。 >
插入图片类的方法失败
小帮助?
解决方案
尝试:
Dim link as Variant
然后输出该值,看看它出错了。我最好的猜测是,您的网址没有按照您的预期方式阅读。
Tried to make a macro that progressively inserts 3 images in Excel
One worksheet (pics) contains the URLs of images in Column A row 1-3
The other worksheet (outputs) is supposed to output the images horizontally.
Sub testinsertpix()
Dim i As Integer
Dim link As String
For i = 1 To 3
link = Worksheets("pics").Cells(i, "A").Value
Cells(1, i).Select
ActiveSheet.Pictures.Insert (link)
Next i
End Sub
It does insert the first image, but fails when the loop reaches the 2nd picture.
"Insert method of Pictures class failed"
Little help please?
解决方案
Try:
Dim link as Variant
Then output the value and see where it's going wrong. My best guess is your URL isn't being read the way you'd expect.
这篇关于将图片插入到Excel VBA中,方法图片失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文