microsoft internet controls document create date (1 Viewer)

conception_native_0123

Well-known member
Local time
Today, 11:53
Joined
Mar 13, 2021
Messages
1,834
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

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.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 00:53
Joined
May 7, 2009
Messages
19,227
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
 

conception_native_0123

Well-known member
Local time
Today, 11:53
Joined
Mar 13, 2021
Messages
1,834
I am waiting until it loaded arnelgp. i am breaking code with breakpoints. i am watching with my eyes
 

conception_native_0123

Well-known member
Local time
Today, 11:53
Joined
Mar 13, 2021
Messages
1,834
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
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 00:53
Joined
May 7, 2009
Messages
19,227
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.
 

conception_native_0123

Well-known member
Local time
Today, 11:53
Joined
Mar 13, 2021
Messages
1,834
i know arnelgp, but it breaks BEFORE the printing happens! :) i just manually wait until it loads fully
 

Users who are viewing this thread

Top Bottom