+ Reply to Thread
Results 1 to 10 of 10

Path to save file

  1. #1
    Forum Contributor
    Join Date
    06-14-2013
    Location
    jk
    MS-Off Ver
    Excel 2007
    Posts
    326

    Path to save file

    Hi,

    Google and all these Guru's on this forum helped me to create a macro.
    The location of this macro file is somewhere (different people use it and they have it on different places which shouldn't matter).

    The macro picks up files from a selected folder. (so it opens a window where you can choose your folder where the files are.)

    Somewhere later in the macro it asks to save a file, and i want to save it in the same folder as where it picked up the files earlier.

    The code to pick up the items is:
    Please Login or Register  to view this content.

    The manual step now is that a window opens to save the file, which always needs to go in the folder where it picked the files earlier anyway.

    the code i use for this is:

    Please Login or Register  to view this content.

    Does anyone know if it 'remembers' this Get_Folder_path. So it automatically saves this New file in the earlier chosen path?
    Thanks for all the help and i'm sorry if i'm unclear....

    Thanks,
    Crispy85

  2. #2
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Path to save file

    As you can see, GetParentFolderName will suffice.
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    06-14-2013
    Location
    jk
    MS-Off Ver
    Excel 2007
    Posts
    326

    Re: Path to save file

    Hi Kenneth,
    Thanks for your answer, but i don't really understand.

    In this sub i still have to choose the folder where i want to save the "New.xls". I want it to automatically save the file in the folder that i have chosen earlier with:

    Please Login or Register  to view this content.
    Thanks
    Last edited by Crispy85; 07-09-2015 at 10:00 AM.

  4. #4
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Path to save file

    I am not sure what you are asking. Have you not gotten it when you used?
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    06-14-2013
    Location
    jk
    MS-Off Ver
    Excel 2007
    Posts
    326

    Re: Path to save file

    Sorry, i'm pretty much beginning in VBA so that's maybe why i am a bit unclear.
    Step 1) i choose a folder with files with the macro i showed in my first post
    Step 2) then it opens the files from that folder
    Step 3) the macro makes adjustments and such things in the open files (script is not in my first post)
    Step 4) then it makes a new book that it needs to save (In my example it is "New.XLS"

    How things now are going it ask the user to save the file. This file always need to go in the folder that is chosen with step 1.

    So i was wondering if anybody knows a way to let vba save the file (step 4) automatically in the same folder that is chosen with step 1. (it's one more step less manually)

  6. #6
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Path to save file

    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    06-14-2013
    Location
    jk
    MS-Off Ver
    Excel 2007
    Posts
    326

    Re: Path to save file

    Hi Kenneth!

    Yes i was thinking about this, the only problem now is: it saves the file in the folder where the macro is located. While it should save it in the folder with the files i chose, if you understand what i mean.

  8. #8
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Path to save file

    Yes, I would expect that if the user chose that path. If they pick another in your function's dialog, then that one would be set.

    The method I gave gives you the folder of some file. That may or may not help. It just depends on your goals.

  9. #9
    Forum Contributor
    Join Date
    06-14-2013
    Location
    jk
    MS-Off Ver
    Excel 2007
    Posts
    326

    Re: Path to save file

    Does anyone else have an idea?
    I have an idea but i don't know how to program it lol.

    Maybe when the folder is selected, it puts the path's name as value in workbook "Macro" and sheet "Start" in range A1.
    Later it could use this as a reference to the right path?

  10. #10
    Forum Contributor
    Join Date
    06-14-2013
    Location
    jk
    MS-Off Ver
    Excel 2007
    Posts
    326

    Re: Path to save file

    Hi everyone,

    i want to bump this topic.
    As shown in my first post. My macro picks up files from a chosen folder.
    Is it possible to put the chosen path as text in my sheet?

    For example: the path C:\Test\test is chosen and the macro puts this as text in cell a1 in sheet "start"

    Thanks for all the help.

+ 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. [SOLVED] Save file as macro-enabled with path and file name from a cell
    By BRISBANEBOB in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-12-2015, 11:51 PM
  2. how to specify a file save path to a save macro
    By Solidstan in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-04-2013, 05:33 PM
  3. Macro to save sheet as CSV using a dynamic file name and file path
    By chris.tinta in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-15-2013, 10:45 AM
  4. Replies: 0
    Last Post: 01-27-2013, 12:13 PM
  5. [SOLVED] Save As Dialog Box - Default Path and File Name, User Selects Sub Folder from Default Path
    By christenprochaska in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-12-2012, 05:17 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