'Code to Open selected excel file ( File Dialog Box )
Sub File_DialogBox_1()
Dim fldg As FileDialog
Set fldg = Application.FileDialog(msoFileDialogOpen) 'Open Dialog Box
fldg.Show 'Display of dialog box
fldg.Execute 'Execution of the selected file
End Sub
--------------------------------------------------------------------------------------------------------------------------
'Code to Select file and display path
Sub File_DialogBox_2()
Dim fldg As FileDialog
Set fldg = Application.FileDialog(msoFileDialogFilePicker) 'File Picker
fldg.Show
'Display of Path
MsgBox "Path of the selected file: " & fldg.SelectedItems(1)
End Sub
--------------------------------------------------------------------------------------------------------------------------
'Code to Select folder and display path
Sub File_DialogBox_3()
Dim fldg As FileDialog
Set fldg = Application.FileDialog(msoFileDialogFolderPicker) 'Folder Picker
fldg.Show
'Display of Path
MsgBox "Path of the selected folder: " & fldg.SelectedItems(1)
End Sub
--------------------------------------------------------------------------------------------------------------------------
'Code to save workbook and display path
Sub File_DialogBox_4()
Dim fldg As FileDialog
Set fldg = Application.FileDialog(msoFileDialogSaveAs) 'Save As
fldg.Show
'Display of Path
MsgBox "Path of the selected file: " & fldg.SelectedItems(1)
End Sub
Sub File_DialogBox_1()
Dim fldg As FileDialog
Set fldg = Application.FileDialog(msoFileDialogOpen) 'Open Dialog Box
fldg.Show 'Display of dialog box
fldg.Execute 'Execution of the selected file
End Sub
--------------------------------------------------------------------------------------------------------------------------
'Code to Select file and display path
Sub File_DialogBox_2()
Dim fldg As FileDialog
Set fldg = Application.FileDialog(msoFileDialogFilePicker) 'File Picker
fldg.Show
'Display of Path
MsgBox "Path of the selected file: " & fldg.SelectedItems(1)
End Sub
--------------------------------------------------------------------------------------------------------------------------
'Code to Select folder and display path
Sub File_DialogBox_3()
Dim fldg As FileDialog
Set fldg = Application.FileDialog(msoFileDialogFolderPicker) 'Folder Picker
fldg.Show
'Display of Path
MsgBox "Path of the selected folder: " & fldg.SelectedItems(1)
End Sub
--------------------------------------------------------------------------------------------------------------------------
'Code to save workbook and display path
Sub File_DialogBox_4()
Dim fldg As FileDialog
Set fldg = Application.FileDialog(msoFileDialogSaveAs) 'Save As
fldg.Show
'Display of Path
MsgBox "Path of the selected file: " & fldg.SelectedItems(1)
End Sub
No comments:
Post a Comment