Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Exporting data to Excel file | Excel Programming | |||
Exporting excel to text file | Excel Discussion (Misc queries) | |||
Exporting excel to text file | Excel Discussion (Misc queries) | |||
importing/exporting lists of names/addresses into and out of excel | Excel Discussion (Misc queries) | |||
Excel VBA - Exporting values to a txt file | Excel Programming |