Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 125
Default How to Prompt a user to select a Folder.

Hi,

I am using the following codes to track our all the Excel file in a
specific folder.

Sub anotherfindfiles()
Application.ScreenUpdating = False
Dim FN As String ' For File Name
Dim ThisRow As Long
Dim MediaFileLocation As String
MediaFileLocation = "D:\Aki\Data\Excel\Formats\*.xls"
FN = Dir(MediaFileLocation)
Do Until FN = ""
ThisRow = ThisRow + 1
Cells(ThisRow, 1) = FN
FN = Dir
Loop
Application.ScreenUpdating = True
End Sub


Its working fine but the the i want that system should prompt me to
select the folder. I mean to say that as soon as the macro is started
it should ask to choose the folder with the browse function. and as
soon as the user selects a folder and click on Ok it should display
the list of excel files in the specific folder.

How can we do that.

Thanks

Akash Maheshwari

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default How to Prompt a user to select a Folder.

See this page at John Walkenbach's site:

http://www.j-walk.com/ss/excel/tips/tip29.htm

--
Regards,
Tom Ogilvy


"Akash" wrote:

Hi,

I am using the following codes to track our all the Excel file in a
specific folder.

Sub anotherfindfiles()
Application.ScreenUpdating = False
Dim FN As String ' For File Name
Dim ThisRow As Long
Dim MediaFileLocation As String
MediaFileLocation = "D:\Aki\Data\Excel\Formats\*.xls"
FN = Dir(MediaFileLocation)
Do Until FN = ""
ThisRow = ThisRow + 1
Cells(ThisRow, 1) = FN
FN = Dir
Loop
Application.ScreenUpdating = True
End Sub


Its working fine but the the i want that system should prompt me to
select the folder. I mean to say that as soon as the macro is started
it should ask to choose the folder with the browse function. and as
soon as the user selects a folder and click on Ok it should display
the list of excel files in the specific folder.

How can we do that.

Thanks

Akash Maheshwari


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 107
Default How to Prompt a user to select a Folder.

Especially the note at the bottom of that page regarding XL 2002 onwards..
--
p45cal


"Tom Ogilvy" wrote:

See this page at John Walkenbach's site:

http://www.j-walk.com/ss/excel/tips/tip29.htm

--
Regards,
Tom Ogilvy


"Akash" wrote:

Hi,

I am using the following codes to track our all the Excel file in a
specific folder.

Sub anotherfindfiles()
Application.ScreenUpdating = False
Dim FN As String ' For File Name
Dim ThisRow As Long
Dim MediaFileLocation As String
MediaFileLocation = "D:\Aki\Data\Excel\Formats\*.xls"
FN = Dir(MediaFileLocation)
Do Until FN = ""
ThisRow = ThisRow + 1
Cells(ThisRow, 1) = FN
FN = Dir
Loop
Application.ScreenUpdating = True
End Sub


Its working fine but the the i want that system should prompt me to
select the folder. I mean to say that as soon as the macro is started
it should ask to choose the folder with the browse function. and as
soon as the user selects a folder and click on Ok it should display
the list of excel files in the specific folder.

How can we do that.

Thanks

Akash Maheshwari


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default How to Prompt a user to select a Folder.

Akash,

See www.cpearson.com/excel/BrowseFolder.aspx for example VBA code.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting
www.cpearson.com
(email on the web site)


"Akash" wrote in message
oups.com...
Hi,

I am using the following codes to track our all the Excel file in a
specific folder.

Sub anotherfindfiles()
Application.ScreenUpdating = False
Dim FN As String ' For File Name
Dim ThisRow As Long
Dim MediaFileLocation As String
MediaFileLocation = "D:\Aki\Data\Excel\Formats\*.xls"
FN = Dir(MediaFileLocation)
Do Until FN = ""
ThisRow = ThisRow + 1
Cells(ThisRow, 1) = FN
FN = Dir
Loop
Application.ScreenUpdating = True
End Sub


Its working fine but the the i want that system should prompt me to
select the folder. I mean to say that as soon as the macro is started
it should ask to choose the folder with the browse function. and as
soon as the user selects a folder and click on Ok it should display
the list of excel files in the specific folder.

How can we do that.

Thanks

Akash Maheshwari


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
Prompt user to select directory Dan R. Excel Programming 3 March 2nd 07 07:22 PM
Prompt user to select a printer using a checkbox within a user Tom Ogilvy Excel Programming 0 January 10th 07 03:57 AM
how do I prompt the user to select a cell? [email protected] Excel Programming 1 December 19th 06 11:42 PM
Dialog box for user to select a folder hmm Excel Programming 6 November 22nd 06 10:09 AM
allow user to select folder jbhoop Excel Discussion (Misc queries) 3 January 3rd 06 10:10 PM


All times are GMT +1. The time now is 10:50 AM.

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"