+ Reply to Thread
Results 1 to 4 of 4

Want to save a file with part of the name derived from an inputbox

  1. #1
    Registered User
    Join Date
    08-20-2007
    Posts
    24

    Want to save a file with part of the name derived from an inputbox

    Hello all,

    Maybe you can help me with this. I am looking to create a macro that will create a new periods worth of spreadsheets. This will open the template file, and do a save as for the new name. I am wondering if I can make it so that it will take the current file name:

    Example: C:/data/rev/account 2130/account 2130 Template.xls

    And I would want it to do a replacement of Template in the file name, to whatever the value in cell A1 is. I have an imput box, where the user will input the month name into the box, it will save to A1, and then I would use that to change the file names. Is that possible?

    If it is easier, I can change the name of the files to exclude the template name, and just use the data to append the name, prior to .xls.

    Any thoughts? Suggestions?

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,483

    Save Macro

    Try this, see if it works for you,
    The folders need to exist though..

    Please Login or Register  to view this content.
    Try to save the workbook with the macro recorder and compare the codes
    Last edited by davesexcel; 08-22-2007 at 04:31 PM.

  3. #3
    Registered User
    Join Date
    08-20-2007
    Posts
    24

    I will try this...

    I will try to manipulate this, but I may need to restate what I was going to do because I did not give the file path correctly.

    I am taking a file C:/data/rev/FY2007/Templates/account 2130 Template.xls

    And looking to do a Save As so that it would be

    C:/data/rev/FY2007/account 2130/account 2130 July Rec.xls

    The July portion would be what is returned from the InputBox, and is returned into cell A1. Maybe a find -- Replace by the contents in cell A1? Is that possible?

    Maybe another option that I have would be to do this once with the macro recorder all the way through, and then make a macro that would do a find -- replace each month? Can you do a find -- replace with a macro?
    Last edited by camcrazy08; 08-22-2007 at 04:08 PM.

  4. #4
    Registered User
    Join Date
    08-20-2007
    Posts
    24

    Thanks

    Your syntax helped immensely. I tweaked it for what I was looking for, and this was what I ended up with, which works great!

    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)

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