Results 1 to 4 of 4
  1. #1
    RayMilhon is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2011
    Location
    Southern California
    Posts
    1,085

    Changing a file name

    I have a couple of queries that are run weekly. The results are exported to Excel and the Excel files are emailed to the user. I have this set up to run Every Monday at 5 AM so the user has the data is his inbox when he comes in to work. What I'd like to do is include in the VBA so the file name is changed after the email is sent to create a history of the files that were sent.



    For example:
    The Data is exported to Claim_Audit_Facilities and Claim_Audit_Professional Excel Spreadsheets and emailed to the User. After that is completed I want to change both file names to include the underscore and the rundate. So the filename would change to Claim_Audit_Facilities_12272017 and Claim_Audit_Professional_12272017.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    Why not assign those suffixes to the file name before sending?

    This works for me:

    Name "C:\Users\June\MyStuff\DMV.pdf" As "C:\Users\June\MyStuff\DMV2.pdf"

    Post your code if you need help adapting.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    RayMilhon is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2011
    Location
    Southern California
    Posts
    1,085
    The storage of files sent is for my purpose only the user doesn't want or need it. That's why I want to change the name after the file is sent. First it gives me a history of what was sent since this process will be automated. Second I can see as soon as I come in if there was an issue with the sending of the files even if I've been on vacation for a couple of weeks.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    So the user doesn't really care what the file name is? If it simplifies the process to name before sending then why not?

    As I said, post your code if you need help adapting the method to your procedure, whichever way you want to use it.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 11-30-2017, 03:15 PM
  2. Changing data type with linked file
    By suprdave in forum Import/Export Data
    Replies: 2
    Last Post: 01-20-2016, 10:37 AM
  3. VBA code to open a file with a dynamically changing filename
    By orangeman2003 in forum Programming
    Replies: 1
    Last Post: 09-09-2014, 06:17 PM
  4. Replies: 5
    Last Post: 08-27-2014, 01:46 PM
  5. Changing File Location in saved imports using VBA
    By akshatagarwal93 in forum Import/Export Data
    Replies: 3
    Last Post: 07-23-2012, 10:47 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums