
Sub Open_File() Dim fd As FileDialog, SelFile Set fd = Application.FileDialog(msoFileDialogFilePicker) Set wb = ActiveWorkbook If fd.Show = -1 Then SelFile = fd.SelectedItems(1) ActiveCell.Value = SelFile Workbooks.Open Filename:=SelFile End If End Sub |
selFile = Application.GetOpenFilename("Text Files (*.txt), *.txt")
If fileToOpen <> False Then
ActiveCell.Value = selFile
Workbooks.Open Filename:=SelFile
End If |
for each f in fso.GetFolder("path").Files
s = s & f.name & vbcrlf
next
msgbox s
