+ Reply to Thread
Results 1 to 3 of 3

Thread: Initiate Export to Access from Excel

  1. #1
    Registered User
    Join Date
    12-30-2011
    Location
    Pretoria, South Africa
    MS-Off Ver
    Excel 2007
    Posts
    4

    Initiate Export to Access from Excel

    Is it possible to initiate an export from Excel to Access from Excel?

    Excel Help does not specify this as an option. I also cannot find it discussed on forums.

    Multiple users are using individual, but uniformed spreadsheets for data input. I am attempting to centralize the separate excel files into one access file. Even though the spreadsheet environment is not shared and centralized, the access file is centralized.

    It is not feasible for me to run docmd.transferSpreadsheet from Access because there are too many excel files to reference. A better way is for the excel files to include an identical macro that references on Access file.

    Secondary question: is it possible to export excel worksheets to other excel files? In this scenario I could centralize all the data into one excel file before importing that file into Access.

    I welcome any suggestions on other ways to solve this problem of consolidating multiple uniformed spreadsheets into one file.

    Thank you.

  2. #2
    Valued Forum Contributor alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Lake County, Illinois
    MS-Off Ver
    MS Office 2010, 2007 and 2002
    Posts
    1,161

    Re: Initiate Export to Access from Excel

    Here's a link with instructions and some code to help you get there.

    http://www.exceltip.com/st/Export_da...Excel/425.html

    Alan

  3. #3
    Registered User
    Join Date
    04-19-2010
    Location
    Ohio, USA
    MS-Off Ver
    Excel 2007
    Posts
    76

    Re: Initiate Export to Access from Excel

    ADODB is awesome. That is going to give you the most control, but for larger sheets it could be slow since it uses a cursor. However I could be doing my ADODB wrong

    On your secondary question, yes it is possible to normalize your data to one sheet using VBA to grab data from many sheets. This is pretty object heavy and you need to open the files from within Access to do so. On your main data sheet I would make a control sheet, where you list all the filenames/paths of the worksheets your users are updating. Then do a for/each for those.

    For each wbPath in wbRange
         Workbooks.open(wbPath)
         ..do stuff to transfer data from the user sheets to your central sheet.
         Activeworkbook.close
    Next wbPath
    Then you have your data in one spot.

    If you can get it to one sheet in a nice table/header format I would recomend using something like..

    DoCmd.DeleteObject acTable, "myTable" 'Deletes your old table.
    DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel12, "myTable", "C:\myWorkbook.xls", -1, "Sheet1!" 'Creates your new table from the data on sheet 1.
    This will import a big chunk of data without having to go row by row. I have a report that has a 9k line excel feeder sheet, ADODB takes about a minute and a half to update. This takes about 10 seconds. I would say if you have a smaller recordset use ADODB, it's an amazing skill to learn for the future but a block import might be better for a larger recordset.

+ Reply to Thread

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