Results 1 to 7 of 7
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Read property of file and store date ... (2000 sr -1)

    I use this line to open file for txt import,.... now before to import i want read the last date of modify, see attacched img...
    After the date is read store in cell J1 oh sheet named STATISTICA..

    part of code
    ....
    NomeFile = "svp077applgaf_out5009581550095815.TXT"

    Open NomeFile For Input As #iFile

    .....

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Read property of file and store date ... (2000 sr -1)

    Dim fso As Object
    Dim f As Object

    Set fso = CreateObject("Scripting.FileSystemObject")
    Set f = fso.GetFile(NomeFile)
    Sheets("Statistica").Range("J1") = f.DateLastModified

    Set f = Nothing
    Set fso = Nothing

  3. #3
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Read property of file and store date ... (2000

    Hi Hans, welcome in my home....
    Not completly uderstand, attached my code...please modify with your suggestion, tks.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Read property of file and store date ... (2000

    Insert the code I posted below the line

    NomeFile = "svp077applgaf_out5009581550095815.TXT"

  5. #5
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Read property of file and store date ... (2000

    ok... but wath is the difference to insert the dim variable into body of code or in head of macro, i isert in all my code always in head of code, is a good idea, or not?

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Read property of file and store date ... (2000

    You can place a declaration (Dim ...) anywhere in the macro before the point where the variable is first used, but it is best to place the declarations immediately below the Sub ... line. That way, the declarations are easier to maintain.

  7. #7
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Read property of file and store date ... (2000

    OK MY TEACHER!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •