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
Solved

Importing workbook with two sheets using TransferSpreadsheet function

Posted on 2014-03-16
2
291 Views
Last Modified: 2014-03-17
Good Day Experts,

I used the coding below to import two sheets from the CSWMatch workbook.  But the second sheet comes in the same as the first. Can you tell me what I am doing wrong?

Let me know

Thanks

Private Sub importExcelSpreadsheet()
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, _
"CSWMatch", "C:\Users\Beeyenme\Desktop\CSWMatch.xlsx", True, "TerminatorFAC!"

DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, _
"FACMatch", "C:\Users\Beeyenme\Desktop\CSWMatch.xlsx", True, "CScomander!"
CSWMatch.xlsx
CSWMatch.accdb
0
Comment
Question by:Beeyen
2 Comments
 
LVL 20

Accepted Solution

by:
GrahamMandeno earned 500 total points
ID: 39933501
Try using a dollar sign instead of the exclamation mark:

DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, _
"CSWMatch", "C:\Users\Beeyenme\Desktop\CSWMatch.xlsx", True, "TerminatorFAC$"
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, _
"FACMatch", "C:\Users\Beeyenme\Desktop\CSWMatch.xlsx", True, "CScomander$"

- Graham Mandeno [Access MVP 1996-2014]
0
 

Author Closing Comment

by:Beeyen
ID: 39933864
That worked great!  Thanks
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

840 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