从网址插入图片 [英] Insert image from URL

查看:48
本文介绍了从网址插入图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下代码适用于大多数图像URL,但是对于该特定URL,我会遇到错误:

The following code works fine with most image URL's, but for this specific URL I am getting errors:

Sub test()
Sheets(1).Shapes.AddPicture "https://images-na.ssl-images-amazon.com/images/M/MV5BYzVlY2JiODctNGMzNC00OWE5LTg3MTEtNDQ3NDYxNjIxNTBiXkEyXkFqcGdeQXVyNTM3MDMyMDQ@._V1_.jpg" _
                          , msoFalse, msoTrue, 100, 100, 500, 600
End Sub

运行时错误'1004':找不到指定的文件

Run-time error '1004': The specified file wasn't found

这是由指定此特定的URL字符串的方式引起的(与VBA不兼容)吗?还是您认为这与主机阻止访问有关?谢谢.

Is it caused by the way this specific URL string is specified (not compatible with VBA)? Or do you think it has something to do with the host blocking access? Thanks.

推荐答案

尝试查找 *.png 图片.这样就可以了.

Try to look for a *.png pictures. Then it would work.

我曾尝试使用PNG在同一亚马逊网站上使用它-

I have tried with one from the same Amazon website in PNG -

Sub Test()

     Sheets(1).Shapes.AddPicture _
                 "https://images-na.ssl-images-amazon.com/images/I/31TN1u5GEqL.png",  _
                 msoFalse, msoTrue, 100, 100, 500, 600
End Sub

MSDN 他们以 *.bmp 文件为例.

但是, *.jpg 可在许多其他网站上使用.因此,亚马逊可能会对此加以限制.

However, *.jpg works from plenty of other websites. Thus probably Amazon is restricting it.

这篇关于从网址插入图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆