Results 1 to 5 of 5

listing the names of files

Threaded View

  1. #1
    Registered User
    Join Date
    05-12-2005
    Posts
    68

    Question listing the names of files

    hi, I have this code that opens a file and makes it a .wk4 file
    and I want it to also list the names of the files in an excel spreadsheet and put a number of how many files are listed
    
    Sub ConvertFiles()
    
    
    Dim vrtSelectedItem As Variant
    
    Dim FileToOpen As String
    'Declare a variable as a FileDialog object.
    Dim fd As FileDialog
    Set fd = Application.FileDialog(msoFileDialogFolderPicker)
    fd.Title = "Cool Application"
    fd.InitialFileName = "My Documents"
    If fd.Show = -1 Then
    For a = 1 To fd.SelectedItems.Count
    MsgBox fd.SelectedItems(a)
    Dim NextFile As String
    
    NextFile = Dir(fd.SelectedItems(a) & "\*detail*.*")
        Workbooks.Open Filename:=NextFile
        ActiveWorkbook.SaveAs Filename:= _
            NextFile & ".wk4", _
            FileFormat:=xlWK4, Password:="", WriteResPassword:="", _
            ReadOnlyRecommended:=False, CreateBackup:=False
    NextFile = Dir()
    
    Do While NextFile <> ""
        Workbooks.Open Filename:=NextFile
        ActiveWorkbook.SaveAs Filename:= _
            NextFile & ".wk4", _
            FileFormat:=xlWK4, Password:="", WriteResPassword:="", _
            ReadOnlyRecommended:=False, CreateBackup:=False
    NextFile = Dir()
    Loop
    Next
    End If
    
    End Sub
    Last edited by tim64; 05-19-2005 at 01:05 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1