Solved

Importing workbook with two sheets using TransferSpreadsheet function

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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

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.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
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…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

726 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