ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy files from website? (https://www.excelbanter.com/excel-programming/447047-copy-files-website.html)

Robert Crandal[_2_]

Copy files from website?
 
I use Excel 2007 with VBA at work. We also have a company
website that, I believe, is an Intranet only website.

Is it possible to use VBA to extract images from our company
website and copy them to a local folder?

For example, if I type "http://blue/our_site/img/444.001.jpg" in my
Internet Explorer browser at work, an image will load on my
browser. Are there VBA functions that take a URL as above
and copy the file to a target location??

Thanks!



Auric__

Copy files from website?
 
Robert Crandal wrote:

I use Excel 2007 with VBA at work. We also have a company
website that, I believe, is an Intranet only website.

Is it possible to use VBA to extract images from our company
website and copy them to a local folder?

For example, if I type "http://blue/our_site/img/444.001.jpg" in my
Internet Explorer browser at work, an image will load on my
browser. Are there VBA functions that take a URL as above
and copy the file to a target location??


Does it *need* to be VBA? While VBA certainly can do it, it's much simpler to
use a download manager like wget or curl from the command line:
cd "local folder"
wget http://blue/our_site/img/444.001.jpg

--
You seldom learn the names of the truly wealthy and powerful.
You see only their spokesmen. The political arena makes a few
exceptions to this but does not reveal the full power structure.

Robert Crandal[_2_]

Copy files from website?
 
I cant install "wget" or "curl" at work. I thought maybe VBA
had some functions for downloading files from a website.

"Auric__" wrote in message
44.100...
Robert Crandal wrote:

Does it *need* to be VBA? While VBA certainly can do it, it's much simpler
to
use a download manager like wget or curl from the command line:
cd "local folder"
wget http://blue/our_site/img/444.001.jpg



Auric__

Copy files from website?
 
Robert Crandal wrote:

"Auric__" wrote in message
44.100...
Robert Crandal wrote:

Does it *need* to be VBA? While VBA certainly can do it, it's much simpler
to use a download manager like wget or curl from the command line:
cd "local folder"
wget http://blue/our_site/img/444.001.jpg


I cant install "wget" or "curl" at work. I thought maybe VBA
had some functions for downloading files from a website.


Well... if it was me, I'd just run wget from a USB drive... if it was me.

But since you're not me, you can try this:

Declare Function URLDownloadToFile Lib "urlmon" _
Alias "URLDownloadToFileA" (ByVal pCaller As Long, _
ByVal szURL As String, ByVal szFileName As String, _
ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long
Sub grabfile()
URLDownloadToFile 0, "http://blue/our_site/img/444.001.jpg", _
"C:\dir\you\have\write\access\to\444.001.jpg", 0, 0
End Sub

If that doesn't work, there's more than one way to skin this cat. Google for
"automate internet explorer vb", without quotes.

--
In the meantime why let the worry mice gnaw at one's mind?

Robert Crandal[_2_]

Copy files from website?
 
Perfect, that worked very nicely for me. That's exactly what I
was looking for!

Thank you very much!


"Auric__" wrote in message
44.100...
Robert Crandal wrote:


But since you're not me, you can try this:

Declare Function URLDownloadToFile Lib "urlmon" _
Alias "URLDownloadToFileA" (ByVal pCaller As Long, _
ByVal szURL As String, ByVal szFileName As String, _
ByVal dwReserved As Long, ByVal lpfnCB As Long) As
Long
Sub grabfile()
URLDownloadToFile 0, "http://blue/our_site/img/444.001.jpg", _
"C:\dir\you\have\write\access\to\444.001.jpg", 0, 0
End Sub



Cần24982

Cho thuê sân khấu - Thi công lắp dựng sân khấu -LH 0907 150 220


Đạt Phương - Đơn vị chuyên cung cấp, cho thuê âm thanh - ánh sáng - cung cấp, lắp đặt sân khấu phục vụ sự kiện chuyên nghiệp. ... Chuyên thiết kế, cung cấp v* lắp đặt hệ thống thiết bị âm thanh, ánh sáng, không gian, ...sân khấu. Liên hệ Mr Đạt 0911 000 222



[center]












cachmangmuasam

Huyen Tâm Bui :v. Mới chỗ vợ xong gặp trưa đ*p đấy. Gam em phá Nguyen chị M*p Thu gọi Jessica Đang đi chồng cả kêu nay Gấu ăn Gọi Nguyen Bùi về
Bảo Hiểm Chăm sóc sức khỏe

thuynhi182301

l*m bằng cấp 3


All times are GMT +1. The time now is 03:51 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com