microsoft internet controls document create date

conception_native_0123

Well-known member
Local time
Yesterday, 22:13
Joined
Mar 13, 2021
Messages
1,923
i have small code where i trying to get a file's create date and modified date. the code is

Code:
sub testpage()
On Error Resume Next

Dim ie As InternetExplorer
Set ie = New InternetExplorer

ie.Visible = True
ie.Navigate "https://www.twiagemed.com/"

Debug.Print "LAST MODIFIED: " & ie.Document.LastModified
Debug.Print "DATE CREATED: " & ie.Document.dateCreated

ie.Quit

End Sub

i also look at this page just as general reference
https://stackoverflow.com/questions/27800376/how-to-get-file-creation-date-on-browser-using-javascript-or-jquery
but the last modified is coming to me as actually 5 seconds before i run that line of code. so it is telling me on my end. not date of document last modified by uploading on company's end. what am i doing wrong? thank you.
 
you need to wait until the page is loaded:

Do While ie.Busy And ie.ReadyState <> 4
DoEvents
Loop
Debug.Print "LAST MODIFIED: " & ie.Document.LastModified
 
I am waiting until it loaded arnelgp. i am breaking code with breakpoints. i am watching with my eyes
 
arne see i am waiting until it load but i still get the load time as last modify day. why? thank you


pageload.jpg




codee.jpg




report.jpg
 
there is no "wait" on your code.
after ie.navigate, your code will immediately go to the debug.print
regardless if the page is loaded or not.
 
i know arnelgp, but it breaks BEFORE the printing happens! :) i just manually wait until it loads fully
 

Users who are viewing this thread

Back
Top Bottom