Du retter i linjen med FullName, til din fil, her har jeg skrevet "C:\test.txt"
Private Sub ShowFileInfo() ' This subroutine demonstrates the technique Dim hFile As Long Dim WFD As WIN32_FIND_DATA Dim FullName As String Dim Created As String Dim LastWrite As String
' FullName is the path and filename ' Substitute any valid file and path FullName = "C:\test.txt" hFile = FindFirstFile(FullName, WFD)
If hFile > 0 Then Created = FileDate(WFD.ftCreationTime) MsgBox "File Created: " & Created, vbInformation, FullName Else MsgBox "File not found.", vbCritical, FullName End If End Sub
Public Sub oprettet() Set objFSO = CreateObject("Scripting.FileSystemObject") Set ObjNewInfo = objFSO.GetFile("C:\test.txt") MsgBox "date created = " & ObjNewInfo.DateCreated End Sub
Public Sub oprettet() Dim A As Long, B As Long, A1 As Double, B1 As Double, C As Double Set objFSO = CreateObject("Scripting.FileSystemObject") Set ObjNewInfo = objFSO.GetFile("C:\test.txt") MsgBox "date created = " & ObjNewInfo.DateCreated A = Int(Now()) B = Int(ObjNewInfo.DateCreated) A1 = Now() - Int(Now()) B1 = ObjNewInfo.DateCreated - Int(ObjNewInfo.DateCreated) C = ((A - B) + (A1 - B1)) * 24 MsgBox "Alder = " & Format(C - D, "#.00") & " Timer" ' tiden er her decimaltal, så minutter er i 100 dele End Sub
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.