ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   File Information?? (https://www.excelbanter.com/excel-programming/295388-file-information.html)

ianripping[_48_]

File Information??
 
If I have the path to a file in A1. Is there a way that I could get the
informatin about when the file was created to appear in B1?


---
Message posted from http://www.ExcelForum.com/


Bob Phillips[_6_]

File Information??
 
Ian,

Just add this function to your workbook,

Public Function GetDate(rng)
Dim FileName As String
Dim DSO As Object
If TypeName(rng) = "Range" Then
If rng.Cells.Count 1 Then
GetDate = CVErr(xlErrRef)
Exit Function
End If
FileName = rng.Value
Else
FileName = rng
End If

Set DSO = CreateObject("DSOleFile.PropertyReader")
With DSO.GetDocumentProperties(sfilename:=FileName)
GetDate = .DateCreated
End With
End Function



Call like

=GetDate(A1)

or

=GetDate("C:\myTest\volker1.xls")

You do need to have the DSO dll installed and registered?

http://support.microsoft.com/?id=224351

set the section "Steps to Setup and Test"


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"ianripping " wrote in message
...
If I have the path to a file in A1. Is there a way that I could get the
informatin about when the file was created to appear in B1?


---
Message posted from http://www.ExcelForum.com/




ianripping[_53_]

File Information??
 
How would you do the above Loadhigh

--
Message posted from http://www.ExcelForum.com


Bob Phillips[_6_]

File Information??
 
Like so

Dim oFile As Object

Set oFSO = CreateObject("Scripting.FilesystemObject")
Set oFile = oFSO.getFile("C:\myTest\volker1.xls")
MsgBox "Created on " & oFile.Datecreated


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"ianripping " wrote in message
...
How would you do the above Loadhigh?


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 04:01 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com