1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: VBA to add files to Batch Touch

Discussion in 'Software Development' started by jo15765, Dec 9, 2011.

Thread Status:
Not open for further replies.
Advertisement
  1. jo15765

    jo15765 Thread Starter

    Joined:
    Oct 11, 2011
    Messages:
    307
  2. Rollin_Again

    Rollin_Again

    Joined:
    Sep 4, 2003
    Messages:
    4,912
    What exactly are you trying to accomplish and why? If you are simply trying to modify the Create Date, Last Access Date, or Last Modified Date of a specified file you can do that purely using VBA without having to use a 3rd party program. How many directories and/or files are you talking about? Will all file be in the same directory level or will there be subdirectories?

    Rollin
     
  3. jo15765

    jo15765 Thread Starter

    Joined:
    Oct 11, 2011
    Messages:
    307
    Yes. I am only needing to modify file attributes. The file location varies so if I could manually input location that would be awesome. The type of files if it matters are .xls and. Pdf
     
  4. Rollin_Again

    Rollin_Again

    Joined:
    Sep 4, 2003
    Messages:
    4,912
    Take a look at the sample workbook I attached. Open the workbook and click the button to first select the directory to process. You will then be prompted for the file extension (e.g - txt, pdf, xls, etc.) or you can enter an asterix character * to process all files regardless of the file type. The macro will modify all three file attribute (created time, modified time, and last accessed time) with the current date and time. Let me know if you have any questions or need help modifying it further. If this works for you then we can add the code to move the files to the location of your choice.

    Rollin
     

    Attached Files:

  5. jo15765

    jo15765 Thread Starter

    Joined:
    Oct 11, 2011
    Messages:
    307
    That code seems to do the trick perfectly. One question about the coding....You declared Private Type I have never used this before...can you explain what this does, and your reasoning for using it to me?

    Thanks!
     
  6. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1030499

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice