DocumentProperty of .csv file is Nothing

P

Peter Ostermann

Hi folks,
for to load a .csv file into a worksheet just and only
when it was changed before, I need the date and
time when change happened.

For to find out which property-item contains the data I need,
I used this routine:

Dim x, y
Dim p As DocumentProperty

workbooks(3).activate
For Each p In ActiveWorkbook.CustomDocumentProperties
x = p.Name
y = p.Value
Next

It doesn't work because p contains "Nothing". Any hints
available how I can "set" p? Getting it pointing - to the
right place?

Regards
Peter Ostermann
 
A

Alok

Hi Peter,
I think the csv file is a text file which cannot store the properties like
..xls files can.
Hence you get p pointing to nothing.
 
N

NickHK

Peter,
As Alok pointed out, these properties are not available to text files, only
file types that support OLE storage.
You would have to store additional data in the actual file as data or read
the standard Windows file info; LastModifieddate etc..

Which properties do you require ?

NickHK
 
P

Peter Ostermann

Hi NickHK, hi Alok,

..... got it functionating. See code below.

NickHK said:
Peter,
As Alok pointed out, these properties are not available to text files,
only
file types that support OLE storage.
You would have to store additional data in the actual file as data or read
the standard Windows file info; LastModifieddate etc..

Which properties do you require ?

NickHK

Private Function lastModified(path) As String
Dim objFSO As Object
Dim objFile As Object

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile(path)

lastModified = objFile.DateLastModified
End Function

Thanks to both of you for feedback.

Best Regards
Peter Ostermann
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top