+ Reply to Thread
Results 1 to 5 of 5

Extract a file with date modified option from a ffolder

  1. #1
    Registered User
    Join Date
    01-06-2014
    Location
    Hyderabad
    MS-Off Ver
    Excel 2010
    Posts
    29

    Extract a file with date modified option from a ffolder

    Dear Team,

    The below macro helps to extract pdf files from a folder. Along with this, I also want to extract a "Date modified" from that same folder. But, I am unable to add that option to the below macro

    ****************************************
    Sub get_pdf_name()
    Dim FR As Long, sh As String, FPath As String, FName As String
    sh = Sheets("Sheet2").Name
    FR = Sheets(sh).Range("A" & Rows.Count).End(xlUp).Row + 1
    FPath = "U:\Personal_Settings\W7Desktop\sent outs"
    FName = Dir(FPath & "\" & "*.pdf*")
    Do While Len(FName)
    Sheets(sh).Range("A" & FR).Value = Left(FName, Len(FName) - 4)
    FR = FR + 1
    FName = Dir
    Loop
    MsgBox "Extraction done" '' Done Extract PDF Names"
    End Sub
    ***********************************

    I had tried adding the below options, but it couldn't serve my requirement

    FPath = "U:\Personal_Settings\W7Desktop\Sent outs " & format(date(),"dd.mm.yyyy")

    or

    FPath = "U:\Personal_Settings\W7Desktop\Sent outs " & format(date(),range("a1").value)

    Hence, requesting you to help me to extract afile name along with the Date modified

    Sample is attached to this thread the filelds which I want to be included in this macro.

    Hope this explains my requirement.

    Thanks in advance for helping me.

    KR
    Chandru...
    Attached Images Attached Images

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Extract a file with date modified option from a ffolder

    Have you looked at the FileSystemObject instead? This will give you a .datelastmodified and .datelastaccessed properties of files.
    Hope this helps

    Sometimes its best to start at the beginning and learn VBA & Excel.

    Please dont ask me to do your work for you, I learnt from Reading books, Recording, F1 and Google and like having all of this knowledge in my head for the next time i wish to do it, or wish to tweak it.
    Available for remote consultancy work PM me

  3. #3
    Registered User
    Join Date
    01-06-2014
    Location
    Hyderabad
    MS-Off Ver
    Excel 2010
    Posts
    29

    Re: Extract a file with date modified option from a ffolder

    Could you please add the FileSystemObject to this code which would be helpful for me to add.

    Thanks
    Chandru...

  4. #4
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Extract a file with date modified option from a ffolder

    I wont add it, but you can google it.

  5. #5
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Extract a file with date modified option from a ffolder

    Hi, Chandrahaas,

    Your opening post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Finding File Creation date, saved date and last modified date
    By david systems in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-22-2013, 05:49 PM
  2. Finding the last modified date on a file
    By koltregaskes in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-25-2011, 05:03 AM
  3. Modified Date:a text file)
    By jtwork in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-25-2007, 07:45 AM
  4. [SOLVED] Set a file's modified date?
    By Ken Loomis in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-30-2005, 09:05 PM
  5. How do I turn on the Last Modified option when opening a file?
    By WomensHealthUSA in forum Excel General
    Replies: 0
    Last Post: 06-08-2005, 11:05 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1