By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,805 Members | 1,202 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,805 IT Pros & Developers. It's quick & easy.

Determining the size of a file via a URL

P: n/a
Hello,

I'd like to determine the size of a file via a URL. I'm not even sure how
to do this on the local machine, let alone a URL. Any help would be greatly
appreciated.

Thanks!

Nov 13 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Not sure about via a URL but in VBA you can retrieve size with the
FileLen function. E.g.

SizeInBytes = FileLen(Pathname)

Nov 13 '05 #2

P: n/a
rkc
Jozef wrote:
I'd like to determine the size of a file via a URL. I'm not even sure how
to do this on the local machine, let alone a URL. Any help would be greatly
appreciated.


If you mean you want to know the size of the source file of a web page
you can send request for the http headers only via a Microsoft.XMLHTTP
object and check the value for Content-Length.

In a nutshell:

Dim msXML As Object
Set msXML = CreateObject("Microsoft.XMLHTTP")
msXML.Open "HEAD", url, False
msXML.send
Debug.Print msXML.getResponseHeader("Content-Length")
Set msXML = Nothing
Nov 13 '05 #3

P: n/a
Excellent! Thanks for your help, that works very well!
"rkc" <rk*@rochester.yabba.dabba.do.rr.bomb> wrote in message
news:VM***************@twister.nyroc.rr.com...
Jozef wrote:
I'd like to determine the size of a file via a URL. I'm not even sure
how
to do this on the local machine, let alone a URL. Any help would be
greatly
appreciated.


If you mean you want to know the size of the source file of a web page
you can send request for the http headers only via a Microsoft.XMLHTTP
object and check the value for Content-Length.

In a nutshell:

Dim msXML As Object
Set msXML = CreateObject("Microsoft.XMLHTTP")
msXML.Open "HEAD", url, False
msXML.send
Debug.Print msXML.getResponseHeader("Content-Length")
Set msXML = Nothing

Nov 13 '05 #4

P: n/a
I can't get the following code to run. I have MSXML 4.0 installed but I
can't find a Type library to Reference so when I key in something like
msXML. nothing pops up as a valid choice to enter after the dot.

Do I need something other than MSXML 4.0 and what Name should I look
for when setting the Reference to a Type library?

I'm using A2003

Dim msXML As Object
Set msXML = CreateObject("Microsoft.XMLHTTP")
msXML.Open "HEAD", url, False
msXML.send
Debug.Print msXML.getResponseHeader("Content-Length")
Set msXML = Nothing


Nov 13 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.