Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Exporting file names to excel

I would like to export file name from "Y:\ReleasedDrawings" to excel.
Can someone help me out?
Thanks
Vedat

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 396
Default Exporting file names to excel

You could use the loop written out he

http://www.jumper.ch/english/e_014.htm


--
Wigi
http://www.wimgielis.be = Excel/VBA, soccer and music


" wrote:

I would like to export file name from "Y:\ReleasedDrawings" to excel.
Can someone help me out?
Thanks
Vedat


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,365
Default Exporting file names to excel

A tried and true method, not dependent on the FSO:

To get it into code to run: press [Alt]+[F11] to open the VB Editor, use the
VB editors menu to Insert | Module and copy the code below and paste it into
the code module. Close the VB editor. Choose Tools | Macro | Macros from
the main Excel menu and run the ExportFileNames macro.

Sub ExportFilenames()
Const basicPath = "Y:\ReleasedDrawings\"
'change worksheet name and
'starting cell
'as needed for your workbook
Const wsName = "Sheet1"
Const startCell = "A2"

Dim anyFilename As String
Dim anyRange As Range
Dim rOffset As Long

rOffset = Cells(Rows.Count, Range(startCell).Column).End(xlUp).Row - 1
Set anyRange = Worksheets(wsName).Range(startCell)
Worksheets(wsName).Select
Application.ScreenUpdating = False ' improves speed
anyFilename = Dir$(basicPath & "*.*", vbNormal)
Do Until anyFilename = ""
anyRange.Offset(rOffset, 0) = anyFilename
rOffset = rOffset + 1
anyFilename = Dir$()
Loop
anyRange.Select
Application.ScreenUpdating = True

End Sub


" wrote:

I would like to export file name from "Y:\ReleasedDrawings" to excel.
Can someone help me out?
Thanks
Vedat


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Exporting file names to excel

On Aug 1, 11:54 am, JLatham <HelpFrom @ Jlathamsite.com.(removethis)
wrote:
A tried and true method, not dependent on the FSO:

To get it into code to run: press [Alt]+[F11] to open the VB Editor, use the
VB editors menu to Insert | Module and copy the code below and paste it into
the code module. Close the VB editor. Choose Tools | Macro | Macros from
the main Excel menu and run the ExportFileNames macro.

Sub ExportFilenames()
Const basicPath = "Y:\ReleasedDrawings\"
'change worksheet name and
'starting cell
'as needed for your workbook
Const wsName = "Sheet1"
Const startCell = "A2"

Dim anyFilename As String
Dim anyRange As Range
Dim rOffset As Long

rOffset = Cells(Rows.Count, Range(startCell).Column).End(xlUp).Row - 1
Set anyRange = Worksheets(wsName).Range(startCell)
Worksheets(wsName).Select
Application.ScreenUpdating = False ' improves speed
anyFilename = Dir$(basicPath & "*.*", vbNormal)
Do Until anyFilename = ""
anyRange.Offset(rOffset, 0) = anyFilename
rOffset = rOffset + 1
anyFilename = Dir$()
Loop
anyRange.Select
Application.ScreenUpdating = True

End Sub



" wrote:
I would like to export file name from "Y:\ReleasedDrawings" to excel.
Can someone help me out?
Thanks
Vedat- Hide quoted text -


- Show quoted text -


Thank you. This is perfect.

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
Exporting data to Excel file Vlash Excel Programming 1 September 29th 06 11:39 AM
Exporting excel to text file Exceluser Excel Discussion (Misc queries) 1 July 1st 05 03:04 AM
Exporting excel to text file Exceluser Excel Discussion (Misc queries) 1 June 29th 05 05:26 AM
importing/exporting lists of names/addresses into and out of excel Bob Z Excel Discussion (Misc queries) 0 April 30th 05 06:56 PM
Excel VBA - Exporting values to a txt file schumacker Excel Programming 2 February 24th 04 09:18 AM


All times are GMT +1. The time now is 12:29 AM.

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

About Us

"It's about Microsoft Excel"