+ Reply to Thread
Results 1 to 4 of 4

Saveas from cell reference in specific folder

  1. #1
    Registered User
    Join Date
    01-31-2013
    Location
    Johannesburg
    MS-Off Ver
    Excel 2003/ 2010
    Posts
    4

    Post Saveas from cell reference in specific folder

    Hi All,

    I am no expert on vb code and usually get by by pasting chunks of code from forums and tutorials etc.

    The first part of my macro, for information/ context is as follows:

    A .csv data file is opened and a macro started, which does the following:
    • Open a template .xlsx file (which is read only to preserve its integrity)
    • Copy 2 columns from the .csv file into a sheet on the template .xlsx file
    • apply various filters required for generating a graph on a second sheet in the same .xlsx template file

    The coding for the above is sorted and works well, but what I need help with is the second part, which I have been struggling to get right:
    Following the above sequence, the following needs to occur:
    • A "Save As" dialogue window to be brought up...
    • Defaulting to a predetermined folder (say C:\folder)
    • Prepopulating the filename with text from a cell reference in the active document (say A:1)
    • Preselecting the file type as .xlsx
    Saving must not be automatic, so that the user can revise the prepopulated file name if required, before clicking on save

    Some code that I have been playing around with for this last part either saves the file as "FALSE.xlsx" or doesnt save anything at all.

    I would appreciate any help anyone can offer

    Lang

  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: Saveas from cell reference in specific folder

    You'll need to play with the actual SAVEAS line of code to get it behave, opening and creating the fileSaveName string in this snippet doesn't actually save the file, it just gets the users input on what the final name should be. Since the user thinks they are saving the file, you should then do that for them.

    Please Login or Register  to view this content.
    _________________
    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
    Registered User
    Join Date
    01-31-2013
    Location
    Johannesburg
    MS-Off Ver
    Excel 2003/ 2010
    Posts
    4

    Re: Saveas from cell reference in specific folder

    Thanks Jerry, thats awesome.

    The savename and the user abort message work beautifully, but for some reason its not defaulting to the specified folder. I have tried different folder names etc and still to no avail.

    I dont know if any of these environments would be causing the problem...
    • Running Excel 2007/2010
    • Running it in the personal macro


    I would appreciate any further advice you can give.

    Thanks again!
    Lang

  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: Saveas from cell reference in specific folder

    The snippet provided is sound. If your window is not opening to the path you have designated in your "InitialName" string, I would suspect a typo of some sort.

+ 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. Button to save workbook, with value in specific cell (H5), in a specific folder
    By markeeny in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-31-2014, 01:15 PM
  2. [SOLVED] macro to save file to specific folder with file name from cell reference
    By mezza89 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-06-2013, 11:32 AM
  3. SaveAs with content of specific cell
    By Smythe78 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-11-2010, 08:40 AM
  4. Save WB from reference found in cell D1 to specific folder
    By Annette in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-13-2006, 12:35 PM
  5. Replies: 1
    Last Post: 01-05-2006, 11:25 AM

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