+ Reply to Thread
Results 1 to 6 of 6

Search for a folder and get folder path using VBA

  1. #1
    Forum Contributor
    Join Date
    06-29-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2016 (Office 365)
    Posts
    137

    Search for a folder and get folder path using VBA

    Hi there,

    I have an excel program running over multiple computers and in it I designate a save folder path when certain items are created from the excel spreadsheet, i.e. PDF documents generated form the worksheets. Now the program is running on different computers I need to find the folder that the documents will will be saved in and then designate its file path to a variable. The folder will generally be on the desktop and is a one drive folder so all documents saved within it will upload to the cloud. Could anyone point me in the right direction on how to search for the folder without knowing its whole path?

    Cheers,
    Marcus

  2. #2
    Registered User
    Join Date
    09-24-2013
    Location
    United States
    MS-Off Ver
    2007, 2010, 2013
    Posts
    7

    Re: Search for a folder and get folder path using VBA

    Variable to be shared with the other computers or just itself to be recalled later in code?

  3. #3
    Forum Contributor
    Join Date
    06-29-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2016 (Office 365)
    Posts
    137

    Re: Search for a folder and get folder path using VBA

    Once the folder is found I will then store its Path to a variable while the saving takes place. This process will repeat each time something is saved and the relevant code runs.

  4. #4
    Registered User
    Join Date
    09-24-2013
    Location
    United States
    MS-Off Ver
    2007, 2010, 2013
    Posts
    7

    Re: Search for a folder and get folder path using VBA

    Does the user get prompt where to save the file? If so you can get the folder path after the user clicks saves and assign it to a public variable.

  5. #5
    Forum Contributor
    Join Date
    06-29-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2016 (Office 365)
    Posts
    137

    Re: Search for a folder and get folder path using VBA

    no it will automatically save to the folder the code finds (without knowing its whole path) and then gets the path, and saves the document within that folder.

  6. #6
    Forum Contributor
    Join Date
    06-29-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2016 (Office 365)
    Posts
    137

    Re: Search for a folder and get folder path using VBA

    The only difference between the file paths on the different computers is the computers username so I have come up with this:

    Please Login or Register  to view this content.
    will Application.UserName always return what I need on different computers or is there a more robust method to use?

    Cheers,
    Marcus

+ 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. [Path location and Document macro]Require File , Folder and sub-folder path creator macro
    By Nitish Shrestha in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-17-2017, 02:23 AM
  2. Replies: 2
    Last Post: 12-29-2015, 04:19 AM
  3. [SOLVED] Help with Macro to find full path of Folder, using input of first 4 chars of folder name
    By Anxiety in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-28-2015, 09:02 AM
  4. VBA to Search Folder Path with spaces
    By Turneron2wheels in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-13-2015, 04:29 AM
  5. Open Folder (Prompt User for final folder name in location path)
    By synergeticink in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-21-2014, 03:33 PM
  6. Code to list the folder path and sub folder path of a specific file
    By kalai1587 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-13-2013, 03:51 AM
  7. search and open folder even if Path changes
    By Desmond_Mocumi in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-05-2013, 02:48 AM

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