Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have tried to right a macro to get the file nanes of the files in a dir on
my c; drive but only get \*.* as a results. And debug takes me to the Print_file = dir() I can not get it to work. Can anyone tell me whats incorrect in the file below. Sub Print_Dir_Contents() Dim Input_Dir, Print_File As String Input_Dir = InputBox("Input the path containing the files you " & _ "want to list on your worksheet" & Chr(13) & Chr(13) & _ "for example:C:\My Documents\*.*") If Input_Dir = "" Then Exit Sub ' If you want only to print a specific file type, you can ' substitute the "\*.*" with "*\.xl*" ' (for Excel files only) for the directory specified in the ' InputBox above. If Application.OperatingSystem Like "*Win*" Then Print_File = Dir(Input_Dir) & "\*.*" End If Range("a1").Select Counter = 1 Do While Len(Print_File) 0 Worksheets(ActiveSheet.Name).Cells(Counter, 1).Value = _ Print_File Print_File = Dir() Counter = Counter + 1 Loop Thanks if you can help Tony |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Links to mapped drive change to refer to local hard drive | Links and Linking in Excel | |||
using a macro to map a drive | Excel Discussion (Misc queries) | |||
is it possible to execute write to the fields in another .xsl form a macro in another .xsl? e.g. some way to load another .xsl into an .xsl macro and write to its data? | Excel Worksheet Functions | |||
Userform Local Drive & Network drive question | Excel Programming | |||
Pasting a range of information from a foler on F Drive to another folder on same drive | Excel Programming |