[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 307
  • Last Modified:

Importing workbook with two sheets using TransferSpreadsheet function

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
Beeyen
Asked:
Beeyen
1 Solution
 
GrahamMandenoCommented:
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
 
BeeyenAuthor Commented:
That worked great!  Thanks
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now