+ Reply to Thread
Results 1 to 6 of 6

how to strip last characters of file name when saving

  1. #1
    Forum Contributor
    Join Date
    12-18-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 365
    Posts
    108

    how to strip last characters of file name when saving

    Hello all,

    I found a brilliant code recently for saving attachments from multiple emails in 1 go, but I need to tweak it a little so it removes the date stamp from the file names and I am no sure how to do this.
    Fo example, I have a few requests send over as "Requests_WH_18_12.xls" but I need them to be saved as "Requests_WH.xls"
    (dropping the "_18_12")

    anyone any thouhts?


    Please Login or Register  to view this content.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: how to strip last characters of file name when saving

    Are the files always .XLS files?
    Are there always 6 characters you want stripped off the end of the filename?
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Contributor
    Join Date
    12-18-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 365
    Posts
    108

    Re: how to strip last characters of file name when saving

    they are indeed always .XLS files JBeaucaire.

    as to the file name, no unfortunately. (I thought it was....)
    If iti s January first, the files are sent over to my team with "_1_1"), so 4 characters.

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: how to strip last characters of file name when saving

    Then something like this to change the filename string right before you save it:

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    12-18-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 365
    Posts
    108

    Re: how to strip last characters of file name when saving

    hmmm.... the macro runs without errors, and states is saved 3 files (whch matches the email in question)
    but.... when I move to the destination folder it remains empty. so looks like no files were actually saved.

  6. #6
    Forum Contributor
    Join Date
    12-18-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 365
    Posts
    108

    Re: how to strip last characters of file name when saving

    what if I instead were to ask the tool to save the file with the RIGHT 15 characters (ans its current extension)

+ 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. Replies: 2
    Last Post: 09-27-2014, 03:38 PM
  2. [SOLVED] Strip invalid characters out of filename
    By CherylC in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-04-2014, 11:28 PM
  3. Hidden characters-saving a file to excel
    By macke in forum Excel General
    Replies: 1
    Last Post: 07-06-2011, 04:44 PM
  4. Replies: 5
    Last Post: 08-05-2005, 09: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