+ Reply to Thread
Results 1 to 6 of 6

FileDateTime for Internet web page

  1. #1
    Mogwai
    Guest

    FileDateTime for Internet web page

    Hi,

    Can you get the Created/LastModified Date for an Internet web page?

    Thanks


  2. #2
    Forum Contributor
    Join Date
    12-11-2004
    MS-Off Ver
    2007
    Posts
    137
    Hello

    I hope this help you


    Sub Informations_And_metaDatas_WebPage()
    'michelxld le 11.05.2005
    'activate Microsoft HTML Objects Library
    'activate Microsoft Internet Controls
    Dim IE As New InternetExplorer
    Dim htmlDoc As HTMLDocument
    Dim htmlRef As IHTMLMetaElement
    Dim i As Byte

    IE.Navigate "http://www.exceltip.com/"
    Do Until IE.ReadyState = READYSTATE_COMPLETE
    DoEvents
    Loop

    Set htmlDoc = IE.Document
    'informations
    MsgBox htmlDoc.Title & vbLf & htmlDoc.fileCreatedDate & _
    vbLf & htmlDoc.LastModified & vbLf & htmlDoc.fileSize & " octets ."

    'metadatas in web Page ( description & keywords )
    For i = 0 To 1
    Set htmlRef = htmlDoc.all.tags("meta").Item(i)
    MsgBox htmlRef.content
    Next i

    Set IE = Nothing
    End Sub


    Regards ,
    michel

  3. #3
    Mogwai
    Guest

    Re: FileDateTime for Internet web page

    Hi Michael,

    Thanks for the reply.

    I was hoping for a means to check a webpage (or file from a web server)
    creation/modified date, without having to open/brows the file.

    Can your macro be altered to achieve this, or would you say such a
    thing was undoable?

    Thanks


  4. #4
    Jake Marx
    Guest

    Re: FileDateTime for Internet web page

    Hi Mogwai,

    Mogwai wrote:
    > I was hoping for a means to check a webpage (or file from a web
    > server) creation/modified date, without having to open/brows the file.
    >
    > Can your macro be altered to achieve this, or would you say such a
    > thing was undoable?


    If you're talking about a web server to which you have direct access, then
    you could probably do this with the FileSystemObject. Otherwise, for a
    remote web page, you would have to make an HTTP request on the URL and
    retrieve the header information in a way like michel demonstrated.

    --
    Regards,

    Jake Marx
    MS MVP - Excel
    www.longhead.com

    [please keep replies in the newsgroup - email address unmonitored]


  5. #5
    Mogwai
    Guest

    Re: FileDateTime for Internet web page

    Hi Jake,

    Thanks for this.

    I would be talking about a remote web page, so don't have direct access
    as such.

    I am trying to get the Date/Time a page was up-loaded to a web server,
    as I believe this to be the most accurate Date/Time (assuming the
    Server clock is correct).

    I know there is Javascript, that can alert the Date/Time for a page and
    the Properties of a page can also show Date/Time details, but these
    don't always match or appear accurate!?!

    Is there no definitive means to finding out when a remote web page
    (Internet/Intranet) was created/up-loaded other than the authors word?

    Heres a random example:

    On following WebPage [ http://www.toggle.org/html/0409art6.htm ] the
    author has indicated that the information was published "Number 256 -
    September 2004", however the Page properties say the page was Created
    and Modified on "06/02/2005". If you follow the instruction within the
    page and enter the Javascript into the address bar, you get the
    following "01/01/1970 01:00:00" ...they can't all be right?

    Thanks


  6. #6
    Jake Marx
    Guest

    Re: FileDateTime for Internet web page

    Hi Mogwai,

    Unfortunately, if you have no control over the web server, there's not much
    you can do. The web server is returning the "Last-Modified" header as part
    of its HTTP response. So if it's not telling the truth (or if there is some
    technical reason that the file is modified often or recreated often), you'll
    get useless information back.

    Here's a way to request just the HTTP headers - should be pretty fast:

    Public Function gsGetLastModifiedDate(rsURL As String) As String
    Dim x As Object

    On Error GoTo ErrHandler

    Set x = CreateObject("MSXML2.XMLHTTP.5.0")

    x.Open "HEAD", rsURL, False
    x.send
    gsGetLastModifiedDate = x.getResponseHeader("Last-Modified")

    ExitRoutine:
    Set x = Nothing
    Exit Function
    ErrHandler:
    Resume ExitRoutine
    End Function

    --
    Regards,

    Jake Marx
    MS MVP - Excel
    www.longhead.com

    [please keep replies in the newsgroup - email address unmonitored]


    Mogwai wrote:
    > Hi Jake,
    >
    > Thanks for this.
    >
    > I would be talking about a remote web page, so don't have direct
    > access as such.
    >
    > I am trying to get the Date/Time a page was up-loaded to a web server,
    > as I believe this to be the most accurate Date/Time (assuming the
    > Server clock is correct).
    >
    > I know there is Javascript, that can alert the Date/Time for a page
    > and the Properties of a page can also show Date/Time details, but
    > these don't always match or appear accurate!?!
    >
    > Is there no definitive means to finding out when a remote web page
    > (Internet/Intranet) was created/up-loaded other than the authors word?
    >
    > Heres a random example:
    >
    > On following WebPage [ http://www.toggle.org/html/0409art6.htm ] the
    > author has indicated that the information was published "Number 256 -
    > September 2004", however the Page properties say the page was Created
    > and Modified on "06/02/2005". If you follow the instruction within the
    > page and enter the Javascript into the address bar, you get the
    > following "01/01/1970 01:00:00" ...they can't all be right?
    >
    > Thanks



+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1