Get FileName with Path from User

Many a times, we come across a situation where we want to 
use different file names with path according to the user 
preference. The following code that I normally use 
to get filenames with path within a procedure helps me 
a lot while developing an application where we need 
user to decide for the file. 
by Selva V Pasupathy

Option Explicit
Private i, j, k As Integer
'   The following procedure helps a user browse for a filename
'   so you can get a full name of the file with path
'   Code written by Selva V Pasupathy
'   HSBC Global Resourcing, Hyderabad1, India

Sub BrowseFileName()
    Dim dlgOpen As FileDialog
    Dim name As String, fileName As String, target As String
    Dim lngIndex As Long
     
    Set dlgOpen = Application.FileDialog(msoFileDialogOpen)
    With dlgOpen
        .AllowMultiSelect = True
        .Show
        For lngIndex = 1 To .SelectedItems.Count
            MsgBox .SelectedItems(lngIndex)
        Next
    End With
End Sub

For more on Resources, Downloads, & Tutorials visit following pages
http://selvavinaygam.googlepages.com
http://socko.350.com

For Feedback and/or recommendations, please mail me at
s o c k o (at) r e d i f f m a i l (dot) c o m

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: