Solved

Importing workbook with two sheets using TransferSpreadsheet function

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

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…
I have a large data set and a SSIS package. How can I load this file in multi threading?
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

770 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