Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,316
Default Using Application.FileDialog(msoFileDialogFolderPicker)

This site will provide you with a the Browse Folder dialog box, which will
return the name of the selected folder:

http://www.vbaexpress.com/kb/getarticle.php?kb_id=246
--
Kevin Backmann


"Ayo" wrote:

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 befo
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.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Takes too long for Filedialog to change directory File selection in office2003 Excel Discussion (Misc queries) 1 May 1st 06 05:33 AM
Application Avi Charts and Charting in Excel 0 April 25th 06 07:17 AM
Application TullaOlsen Excel Discussion (Misc queries) 0 March 16th 06 07:57 PM
FileDialog to select file Acid-Sky Excel Discussion (Misc queries) 2 September 12th 05 06:53 PM
filedialog Norm Excel Worksheet Functions 0 July 29th 05 10:17 PM


All times are GMT +1. The time now is 09:01 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"