Solved

Importing workbook with two sheets using TransferSpreadsheet function

Posted on 2014-03-16
2
287 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Join & Write a Comment

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now