+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    03-04-2010
    Location
    South Florida
    MS-Off Ver
    Excel 2007
    Posts
    72

    Importing Multiple Excel Files Into Access

    Hello,

    I'm trying to import multiple Excel files into Access, but am getting:

    Run-time error '3051':

    The Microsoft Access database engine cannot open or write to
    the file 'C:\Documents and Settings\H\Desktop\03-08-10'. It is
    already opened exclusively by another user, or you need permission
    to view and write its data


    Any suggestions?

    Thank you.

  2. #2
    Registered User
    Join Date
    03-04-2010
    Location
    South Florida
    MS-Off Ver
    Excel 2007
    Posts
    72

    Re: Importing Multiple Excel Files Into Access

    THIS IS MY CODE


    Function Impo_allExcel()

    Dim myfile
    Dim mypath
    mypath = "C:\Documents and Settings\H\Desktop\03-08-10"
    Do
    myfile = Dir(mypath & "*.xls")
    'this will import ALL the excel files (one at a time, but automatically) in this folder. Make sure that's what you want.
    DoCmd.TransferSpreadsheet acImport, 8, "03-08-10", mypath & myfile
    myfile = Dir
    Loop Until myfile = ""

    End Function

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.2.0