+ Reply to Thread
Results 1 to 9 of 9

vba for save as file to specific folder and close that file, but keep original file open.

  1. #1
    Registered User
    Join Date
    11-21-2019
    Location
    india
    MS-Off Ver
    2010
    Posts
    13

    vba for save as file to specific folder and close that file, but keep original file open.

    Hi ,

    Hoping someone can help?

    I have a macro enabled file named as "tax invoice" and need a macro to "File Save As" to specific location for example in "C:\Users\Store\Desktop\Tax Invoice" with specific cell value i.e. "M7" which has Invoice No. in it & close the save as file but keep original "tax invoice" file open for another invoice entry & so on.

    I have tried few macros but they close the original file.

    My aim is to keep original file open for another invoice entry.

    thank you.

    I am attaching same file for reference.
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor saravnepali's Avatar
    Join Date
    01-14-2019
    Location
    Sydney Australia
    MS-Off Ver
    2010
    Posts
    447

    Re: vba for save as file to specific folder and close that file, but keep original file op

    Hi,

    Try below


    Formula: copy to clipboard
    Please Login or Register  to view this content.


    This doesn't require you to open the new file, so no issue of closing the file

    Main file will keep open

    You can call this procedure through a command button or other methods as you wish.
    Last edited by saravnepali; 11-25-2019 at 06:34 AM.
    If you think someone helped you, click on the "* Add Reputation" as a way to say thank you.

    If your problem is solved, go to Thread Tools and select Mark This Thread Solved

  3. #3
    Registered User
    Join Date
    11-25-2019
    Location
    Southend-On-Sea
    MS-Off Ver
    2010
    Posts
    11

    Re: vba for save as file to specific folder and close that file, but keep original file op

    There is no VBA code to directly do what you are asking for.
    You have to do this in few steps:
    1. Create new workbook
    2. copy your existing sheets in your tax invoice file to newly created workbook
    3. save newly create workbook as (ActiveWorkbook.SaveAs)
    4. close newly created workbook

    To the best of my knowledge this is the only possible way of doing this.


    Just realised something - why do you need to close this file at all? Is there any reason for this?

  4. #4
    Registered User
    Join Date
    11-21-2019
    Location
    india
    MS-Off Ver
    2010
    Posts
    13

    Re: vba for save as file to specific folder and close that file, but keep original file op

    I take printout of saved as file with invoice no. So I did not have any use after that.
    I make about 10 invoices a day, so I want to keep open the Original file instead of opening it again and again.

    thanks

  5. #5
    Registered User
    Join Date
    11-25-2019
    Location
    Southend-On-Sea
    MS-Off Ver
    2010
    Posts
    11

    Re: vba for save as file to specific folder and close that file, but keep original file op

    Well… you could update your workbook to capture code in 'Workbook.Save' subroutine and modify it's name there based on the content of the cell? That way, every time you'd press Save you'd end up saving new file with name based on the content of your cell?

  6. #6
    Valued Forum Contributor
    Join Date
    04-01-2015
    Location
    The Netherlands
    MS-Off Ver
    2003/2007/2010/2016/office 365
    Posts
    880

    Re: vba for save as file to specific folder and close that file, but keep original file op

    You can use Savecopyas instead of Saveas.

  7. #7
    Valued Forum Contributor saravnepali's Avatar
    Join Date
    01-14-2019
    Location
    Sydney Australia
    MS-Off Ver
    2010
    Posts
    447

    Re: vba for save as file to specific folder and close that file, but keep original file op

    Quote Originally Posted by rajdh75 View Post
    I take printout of saved as file with invoice no. So I did not have any use after that.
    I make about 10 invoices a day, so I want to keep open the Original file instead of opening it again and again.

    thanks
    Did you tried VBA above

    Any issues with that

  8. #8
    Registered User
    Join Date
    11-21-2019
    Location
    india
    MS-Off Ver
    2010
    Posts
    13

    Re: vba for save as file to specific folder and close that file, but keep original file op

    it save the file, but with no extension. for ex. only 1, and not with 1.xls
    so it could not be open.

  9. #9
    Valued Forum Contributor saravnepali's Avatar
    Join Date
    01-14-2019
    Location
    Sydney Australia
    MS-Off Ver
    2010
    Posts
    447

    Re: vba for save as file to specific folder and close that file, but keep original file op

    Your file has code so has to be saved as XLSM file type.

    Please Login or Register  to view this content.

+ 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. VBA for open files from folder / calling function / save / close the file
    By janet2019 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-18-2019, 06:16 PM
  2. Script/macro to save a copy as tab delimited text file and then close original file
    By Merlin803 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-02-2015, 01:34 PM
  3. Problem With Open File and Save File With Saveas and then close the File
    By John Vieren in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-27-2013, 12:53 AM
  4. Open every file in the folder, remove merge and wrap, save and close files
    By abdesai in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-06-2013, 04:58 PM
  5. How to: Open file, format data, save file, close file and repeat.
    By thexeber in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-11-2010, 12:56 PM
  6. Macro to keep original file open, not 'save as' file
    By LonestarGuy in forum Excel General
    Replies: 4
    Last Post: 06-09-2010, 03:53 PM

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