+ Reply to Thread
Results 1 to 7 of 7

Prompt user to locate a file to then be saved to predetermined directory

  1. #1
    Registered User
    Join Date
    09-06-2013
    Location
    Northamptonshire, England
    MS-Off Ver
    Excel 2003
    Posts
    45

    Prompt user to locate a file to then be saved to predetermined directory

    Hi all,
    I have designed a series of data entry Userforms, one of which requires the user to 'attach' a photograph. I have got as far as creating a button that prompts a Application.GetFilename which then pastes the selected files path into a textbox.

    I was wondering if there is a way to take this a step further and instead of only extracting the file path, it is possible to also take the selected file and copy it into a predetermined directory of my choice.

    Any help or tips would be greatly appreciated.

    Thanks!

  2. #2
    Forum Contributor Obsessed's Avatar
    Join Date
    05-22-2013
    Location
    Cincinnati, Ohio
    MS-Off Ver
    Excel 365
    Posts
    215

    Re: Prompt user to locate a file to then be saved to predetermined directory

    Please Login or Register  to view this content.
    Obviously you can insert string variables as either the source or destination location, and as you've already used you can use the GetFolder function to store the folder locations into a variable...then just append the name and you're finished.
    Last edited by Obsessed; 11-03-2015 at 11:53 AM.

  3. #3
    Registered User
    Join Date
    09-06-2013
    Location
    Northamptonshire, England
    MS-Off Ver
    Excel 2003
    Posts
    45

    Re: Prompt user to locate a file to then be saved to predetermined directory

    Thanks for the reply.

    I am currently at this stage:

    Please Login or Register  to view this content.
    How would I go about using the selected file location (a) in the FileCopy line you suggested above?

  4. #4
    Forum Contributor Obsessed's Avatar
    Join Date
    05-22-2013
    Location
    Cincinnati, Ohio
    MS-Off Ver
    Excel 365
    Posts
    215

    Re: Prompt user to locate a file to then be saved to predetermined directory

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    09-06-2013
    Location
    Northamptonshire, England
    MS-Off Ver
    Excel 2003
    Posts
    45

    Re: Prompt user to locate a file to then be saved to predetermined directory

    This is perfect. Thank you.

    I have tweaked it slightly so that the user is not required to select a destination folder. Additionally I would ideally like the selected file name to be changed to a cell value.

    Please Login or Register  to view this content.
    The example above uses cell "B4" of sheet "New Sign" as the file name. Is it possible to name the file by finding the next available (blank) cell in column "B" and instead using the value of column "A" in that row?

  6. #6
    Forum Contributor Obsessed's Avatar
    Join Date
    05-22-2013
    Location
    Cincinnati, Ohio
    MS-Off Ver
    Excel 365
    Posts
    215

    Re: Prompt user to locate a file to then be saved to predetermined directory

    I'd have to see an example workbook to make sure I'm understanding your request correctly.

    What is your purpose of adding this line?

    Please Login or Register  to view this content.
    Want to show appreciation for the help you received from a member? Give them reps by clicking the bottom left of their post!

  7. #7
    Registered User
    Join Date
    09-06-2013
    Location
    Northamptonshire, England
    MS-Off Ver
    Excel 2003
    Posts
    45

    Re: Prompt user to locate a file to then be saved to predetermined directory

    I seem to have resolved the issue I was having for naming the file by using a different cell reference.

    The line you mentioned above pastes the new destination value into a txtbox within the userform. This path is later added to a worksheet. The reason I have done this is so that the image can easily be hotlinked to the relevant line in the dataset when it is viewed spatially.

    Thanks for your 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] Macro to prompt user to select a file and the selected file should saved in location
    By logesh excel in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-26-2015, 03:43 PM
  2. [SOLVED] Prompt to insert user name in directory
    By jh51745 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-03-2013, 10:01 AM
  3. [SOLVED] Macro to Locate and Delete File saved from cell variable
    By ut1anderson in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-02-2013, 04:22 PM
  4. Prompt User for Directory(folder)
    By cocotrp in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-14-2011, 06:37 PM
  5. Replies: 3
    Last Post: 06-11-2009, 07:08 PM
  6. Locate a File within a Directory's Folders
    By toocold in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-01-2008, 11:48 PM
  7. [SOLVED] prompt user to specify a directory
    By mini in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-20-2006, 01:10 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