Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selecting a folder

Status
Not open for further replies.

Ricjd

Programmer
Sep 12, 2002
104
GB
I have generated a file name for a document and i know how to save it, but now i want to be able to select the folder where it is to be save to.

Is there an easy way to present the user with a folder list which they then select. Hopefully somehting windows intragrated so they can create new files and so forth.

Thanking you in advance

Rick
 
Check out this thread:

thread707-640205



Peace! [peace]

Mike

Never say Never!!!
Nothing is impossible!!!
 
This is the code that will do the job:
Code:
Sub ReturnFileNameToCell()
    Dim Filt As String
    Dim FilterIndex As Integer
    Dim FileName As Variant
    Dim Title As String
'   File filters
    Filt = "Excel Files (*.xls),*.xls," & _
           "Text Files (*.txt),*.txt," & _
           "All Files (*.*),*.*"
'   Default *.*
    FilterIndex = 3
'   Dialog Caption
    Title = "Select a File to Import"
'   File Name
    FileName = Application.GetOpenFilename(FileFilter:=Filt, _
         FilterIndex:=FilterIndex, Title:=Title)
'   Exit on Cancel
    If FileName = False Then
        MsgBox "No file was selected."
        Exit Sub
    End If
'   Return full path and name of the file to a cell
    Range("A1") = "You selected " & FileName
End Sub

It's my code from the thread above.

I hope this helps!


Peace! [peace]

Mike

Never say Never!!!
Nothing is impossible!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top