Results 1 to 9 of 9

Running Macros

Threaded View

  1. #1
    Registered User
    Join Date
    03-11-2009
    Location
    nj
    MS-Off Ver
    Excel 2003
    Posts
    5

    Running Macros

    Hey Guys,
    I'm new to using Macros in Excel and am having problems.
    Although I did not write this code, I believe that it's what I am looking for. I want to upload and append a ton of csv files, but I am getting a run-time error '424' object required message. This is the code:
    Sub Import_multiple_csv_files()
         
        Const strPath As String = "K:\My Documents\"
        Dim strFile As String
        Dim strFileList() As String
        Dim intFile As Integer
        strFile = Dir(strPath & "*.csv")
        While strFile <> ""
            intFile = intFile + 1
            ReDim Preserve strFileList(1 To intFile)
            strFileList(intFile) = strFile
            strFile = Dir()
        Wend
        If intFile = 0 Then
             MsgBox "No files found"
            Exit Sub
        End If
        For intFile = 1 To UBound(strFileList)
            DoCmd.TransferText acImportDelimi, , _
            "Test", strPath & strFileList(intFile)
        Next
        MsgBox UBound(strFileList) & " Files were Imported"
    End Sub
    I'm not sure what to do, can you help me?
    Last edited by ornamentalist; 03-11-2009 at 08:11 AM.

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