ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   DocumentProperty of .csv file is Nothing (https://www.excelbanter.com/excel-programming/378255-documentproperty-csv-file-nothing.html)

Peter Ostermann[_3_]

DocumentProperty of .csv file is Nothing
 
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


Alok

DocumentProperty of .csv file is Nothing
 
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.


"Peter Ostermann" wrote:

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



NickHK

DocumentProperty of .csv file is Nothing
 
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

"Peter Ostermann" wrote in message
...
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




Peter Ostermann[_3_]

DocumentProperty of .csv file is Nothing
 
Hi NickHK, hi Alok,

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

"NickHK" schrieb im Newsbeitrag
...
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



All times are GMT +1. The time now is 07:29 AM.

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