+ Reply to Thread
Results 1 to 3 of 3

VBA INPUT box for file path with browse button

Hybrid View

craig159753 VBA INPUT box for file path... 06-11-2015, 04:02 AM
NeedForExcel Re: VBA INPUT box for file... 06-11-2015, 04:59 AM
michson Re: VBA INPUT box for file... 06-11-2015, 05:01 AM
  1. #1
    Registered User
    Join Date
    05-06-2015
    Location
    Wales
    MS-Off Ver
    2010
    Posts
    13

    VBA INPUT box for file path with browse button

    Hi, so i have some VBA code which will occur once the macro has almost finished, it will prompt the user to enter a path as to where the user wants to save the file, however, is there a way for the user to browse their computer and once they select the correct path it populates the input box with that path?

    My current code

    mypath = InputBox("All Domain tabs were successfully created. Please enter file path location for the newly generated file", fpath, fpath) & "\"
    FPATH is just the current path oh the original EXCEL file.

    Thanks in advance

  2. #2
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,879

    Re: VBA INPUT box for file path with browse button

    Hi,

    Yes there is using FileDialog-

    http://www.wiseowl.co.uk/blog/s209/type-filedialog.htm

    They have an amazing Video Tutorial on their VBA Channel..

    I can't put the Youtube link, as YouTube wont open at my workplace..

    However the uTube channel name is - WiseOwl Tutorials > Excel VBA Introduction > Video 24
    Last edited by NeedForExcel; 06-11-2015 at 05:02 AM.
    Cheers!
    Deep Dave

  3. #3
    Registered User
    Join Date
    09-10-2014
    Location
    Matrix
    MS-Off Ver
    2010
    Posts
    70

    Re: VBA INPUT box for file path with browse button

    Use this code:
    Sub SelectPath()
    Dim path As String
    
    With Application.FileDialog(msoFileDialogFolderPicker)
      .Title = "Select path"
      .AllowMultiSelect = False
      .Show
        If .SelectedItems.Count <> 0 Then
          path = .SelectedItems(1)
        Else
          MsgBox "Incorrect path!"
          Exit Sub
        End If
    End With
    
    MsgBox path
    End Sub
    (*) Reputation points appreciated.
    excelbs.tk

+ 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. How to browse the path for the input files and save the output using a userform
    By priyankaseshadri in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-22-2014, 03:14 PM
  2. how to browse and get the file path of Excel files and place in a cell
    By amethystfeb in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-15-2014, 01:34 PM
  3. Browse button on form for folder path
    By Greshter in forum Excel General
    Replies: 2
    Last Post: 01-12-2006, 06:25 PM
  4. Browse button to select and display the file path
    By sowetoddid in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-25-2005, 05:05 PM
  5. Adding browse button to input box
    By bhofsetz in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-01-2005, 01:24 PM

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