I am working on a project where i am having 8 excel files saved at diffrent location so i want to create userform which will open particular file location and from that user can select the file which he want and then can go further. so i need a coding so that user will be prompt 8 times with file location. for eg. once user select particular file from location then again this code route him to select next file from file location. is it possible??
I tried using below code but in this code when i run userform file is not opening but when i run this code mannually by pressing F8 desired file is opening i dont know what is glitch in this ?? is there any othe code or method which can help me ?? another problem i am facing is not able to understand how to repeat this steps again to open another file using this code??
if someone know any answer help me with this ... cause if someone can crack this i can save arround daily 4 hrs of my work
Private Sub Commandbutton1_Click()
Dim f As FileDialog
Set f = Application.FileDialog(msoFileDialogFilePicker)
MsgBox "select Diamond file"
.Title = "Select a Diamond file..."
.InitialFileName = "H:\Working\macro"
.ButtonName = "Select"
'.Filters.Add "Excel Files", "*.xls", 1
.AllowMultiSelect = False
If .Show = -1 Then
' Below line will put the selected file path in the textbox
TextBox1.Text = .SelectedItems.Item(1)
Shell "cmd /c " & """" & .SelectedItems(1) & """"
End With 'Reset default file path for Open/Save dialogs
'Dim dfp As String
'dfp = Application.DefaultFilePath
'ChDrive Left(dfp, 1)
'Set f = Nothing
Thanks in advance !!