+ Reply to Thread
Results 1 to 11 of 11

Exporting Workbook with new name

  1. #1
    Registered User
    Join Date
    11-10-2011
    Location
    Norway
    MS-Off Ver
    Excel 2003
    Posts
    16

    Exporting Workbook with new name

    I'm currently working on a macro that export several rows and cells to a new workbook which then is saved as a txt-file with the same name as the original workbook.
    I have written and worked out everything except the saving-part. I can't work out how to save the new file with a different name everytime.

    Here's what i got so far:

    Please Login or Register  to view this content.
    Last edited by joehjas; 12-12-2011 at 08:07 AM.

  2. #2
    Forum Contributor wamp's Avatar
    Join Date
    11-10-2008
    Location
    Norway
    MS-Off Ver
    97, 2000 & 2003 (diff. workstations)
    Posts
    184

    Re: Exporting Workbook with new name

    not quite sure what you mean by "different name every time" you couled forinstance date-stamp the file: if that's what you're thinking about?
    Please Login or Register  to view this content.
    _______________________________________________
    Remember:

    Read the rules!

    Use code tags! Place [CODE] before the first line of code and [/CODE] after the last line of code.

    Mark your post [SOLVED] if it has been answered satisfactorily.
    To do this, click EDIT in your original post, click GO ADVANCED and set the PREFIX. It helps everybody!

    If you are approve (or disapprove) of any members response to your problem, please click the star icon underneath their post and comment. It matters.

  3. #3
    Registered User
    Join Date
    11-10-2011
    Location
    Norway
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: Exporting Workbook with new name

    What other operator can i use instead of Date, filename of the original workbook?

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Exporting Workbook with new name

    You are exporting a worksheet not a workbook.

    something like
    Please Login or Register  to view this content.
    Last edited by royUK; 12-13-2011 at 03:08 AM.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  5. #5
    Registered User
    Join Date
    11-10-2011
    Location
    Norway
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: Exporting Workbook with new name

    Okay, maybe I am, but still; what are my options in naming the new file? Is there some way I can insert a different text each time(not date), maybe a increasing number for each time the file is saved?

  6. #6
    Forum Contributor wamp's Avatar
    Join Date
    11-10-2008
    Location
    Norway
    MS-Off Ver
    97, 2000 & 2003 (diff. workstations)
    Posts
    184

    Re: Exporting Workbook with new name

    to put it simple: you can achieve what ever you need; question is: what is it exactly that you want to achieve?
    eg. if you had to do it manually, what would you do, how would you name the files; and why would you name them the way you would?

    (the more info you give, the easier it is for us to understand what you want/need, thus easier to help)

  7. #7
    Registered User
    Join Date
    11-10-2011
    Location
    Norway
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: Exporting Workbook with new name

    Quote Originally Posted by wamp View Post
    to put it simple: you can achieve what ever you need; question is: what is it exactly that you want to achieve?
    eg. if you had to do it manually, what would you do, how would you name the files; and why would you name them the way you would?

    (the more info you give, the easier it is for us to understand what you want/need, thus easier to help)
    The original document, the excel-file, is a template for calculating sales quotes.
    The document is upon creation saved automatically with a number(increasing by 1 each time).
    What I want is the new file to have the same number.

  8. #8
    Forum Contributor wamp's Avatar
    Join Date
    11-10-2008
    Location
    Norway
    MS-Off Ver
    97, 2000 & 2003 (diff. workstations)
    Posts
    184

    Re: Exporting Workbook with new name

    Please Login or Register  to view this content.
    in your example; it would be something like :
    Please Login or Register  to view this content.
    Last edited by wamp; 12-12-2011 at 06:41 AM.

  9. #9
    Registered User
    Join Date
    11-10-2011
    Location
    Norway
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: Exporting Workbook with new name

    Nice, that works
    Any idea how to remove the .xlsm?
    So I'll have 10001.txt instead of 10001.xlsm.txt

  10. #10
    Forum Contributor wamp's Avatar
    Join Date
    11-10-2008
    Location
    Norway
    MS-Off Ver
    97, 2000 & 2003 (diff. workstations)
    Posts
    184

    Re: Exporting Workbook with new name

    alter saveName to:
    Please Login or Register  to view this content.

  11. #11
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Exporting Workbook with new name

    Quote Originally Posted by joehjas View Post
    Okay, maybe I am,
    It makes a big difference

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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