+ Reply to Thread
Results 1 to 6 of 6

Saving a sheet to a specific folder

  1. #1
    Registered User
    Join Date
    05-04-2013
    Location
    Florida, United States
    MS-Off Ver
    Excel 2010
    Posts
    16

    Saving a sheet to a specific folder

    This macro saves a excel file in a certain folder can it be saved to a subfolder with the mactching name
    ie the file name is ro-3170-5-21-13 I would like it saved in a folder named 3170


    ' Saves repair order to its own file in roreq
    Sheets("repair order").Select
    Sheets("repair order").Copy
    thisfile = Range("r54").Value
    ActiveWorkbook.SaveAs Filename:="D:\new sws folder\maintenance\roreq\" & thisfile
    ActiveWorkbook.Close

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Saving a sheet to a specific folder

    Try something like this...

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    05-04-2013
    Location
    Florida, United States
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: Saving a sheet to a specific folder

    this saves it as the first 4 digits it needs to be digits 4 to 7

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Saving a sheet to a specific folder

    Quote Originally Posted by kmraz View Post
    this saves it as the first 4 digits it needs to be digits 4 to 7
    Good to know. Try this...

    strFolder$ = "D:\new sws folder\maintenance\roreq\" & Split(thisfile, "-")(1)

    This gets the text after the 1st "-" up to the 2nd "-". If that doesn't work, can you better explain the pattern to extract and all its variances.

  5. #5
    Registered User
    Join Date
    05-04-2013
    Location
    Florida, United States
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: Saving a sheet to a specific folder

    That worked perfectly thank you this has been busting my chops for days so if I changed the (1) at the end would it give me between the 2nd and 3rd -

  6. #6
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Saving a sheet to a specific folder

    Quote Originally Posted by kmraz View Post
    That worked perfectly thank you this has been busting my chops for days so if I changed the (1) at the end would it give me between the 2nd and 3rd -
    Yes or it nukes your computer. I forget which one.
    You're welcome.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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