Solved

Importing Multiple Worksheets into access

Posted on 2010-11-17
3
510 Views
Last Modified: 2012-11-16
I am trying to Import some data from an excel spreadsheet using the TransferSpreadsheet method and I cannot seem to get the Worksheet part correct with the range.

I am using:  

DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "ExcelTally1", fileName, False, "Excel_Export1"

DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "ExcelTally2", fileName, False, "Excel_Export2"

DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "ExcelTally3", fileName, False, "Excel_Export3"

But it fails each time.
0
Comment
Question by:mjelec
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
3 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 34158639
is "Excel_Export1" the name of the worksheet?, add a Bang (!)

DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "ExcelTally1", fileName, False, "Excel_Export1!"
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 34158645
add a Bang (!) sign to import the whole sheet.
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 34158701
to import a certain range  A1:K100

DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "ExcelTally1", fileName, False, "Excel_Export1!A1:K100"
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question