顯示包含「Excel VBA」標籤的文章。顯示所有文章
顯示包含「Excel VBA」標籤的文章。顯示所有文章

2016年7月14日星期四

Excel VBA 2a:Learning MSXML2.XMLHTTP

Introduction

What is MSXML2.XMLHTTP?

It is an object in Excel VBA for sending request to the server. YOu can use this object to get the response from the website.

MSXML2 objects in Excel VBA

There are many object in Excel VBA in the MSXML2
There should be a little diference between them, but I really don’t know the difference. Ha, maybe I will know in the future.
Now, 6.0 is the updated version.
So far, I just MSXML.XMLHTTP is work fine for me in Excel2010
Microsoft.XMLHTTP
Microsoft.XMLHTTP.1.0
Msxml2.ServerXMLHTTP
Msxml2.ServerXMLHTTP.3.0
Msxml2.ServerXMLHTTP.5.0
Msxml2.ServerXMLHTTP.6.0
Msxml2.XMLHTTP.3.0
Msxml2.XMLHTTP.5.0
Msxml2.XMLHTTP.6.0

2016年4月29日星期五

Excel VBA : Copy image from website into Excel


Cause:

Wondering how to copy image from a internet source and paste to Excel using the VBA.

There are many examples on the internet if you google "copy image from web vba". However, those are too complicate as I just want to copy from a particular website and particular one image.That's it. No more other things.

So I keep searching on the internet to find a proper method.

One of the method is using "URLDownloadToFile API", it is too complicate for me as I am just a beginner of VBA.....

Then I find a good example from stactoverflow. By using AddPicture(x,x,x,x,) method, it is very easy to copy a image to Excel!

However, you must know the URL of the image first...

Luckily, I know the basic DOM knowlege through my studies on Javascript.



Action:

How to know the URL of the source of the particular image: