A
Ayo
I am trying to use Application.FileDialog(msoFileDialogFolderPicker)
to get a folder and run a macro on each file in that folder. I was using
this approach before:
folderspec = Application.InputBox(prompt:="Input Folder Path", Title:="Get
Folder", Type:=2)
but it requires someone to copy and paste the folder path. But I want to
use a different approach where the filedialog opens and you can pick the
folder directly. I know Application.FileDialog(msoFileDialogFolderPicker) is
what is needed but I can figure out what next. This is what I have, and it's
giving me an error
folderspec = Application.FileDialog(msoFileDialogFolderPicker)
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.getFolder(folderspec)
Set fc = f.Files
For Each f1 In fc
s = f1.Path
Workbooks.Open Filename:=s, UpdateLinks:=0
Thanks for the help.
to get a folder and run a macro on each file in that folder. I was using
this approach before:
folderspec = Application.InputBox(prompt:="Input Folder Path", Title:="Get
Folder", Type:=2)
but it requires someone to copy and paste the folder path. But I want to
use a different approach where the filedialog opens and you can pick the
folder directly. I know Application.FileDialog(msoFileDialogFolderPicker) is
what is needed but I can figure out what next. This is what I have, and it's
giving me an error
folderspec = Application.FileDialog(msoFileDialogFolderPicker)
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.getFolder(folderspec)
Set fc = f.Files
For Each f1 In fc
s = f1.Path
Workbooks.Open Filename:=s, UpdateLinks:=0
Thanks for the help.