How do I reference a specific worksheet in an excel workbook.
This is part of a restore process that I am doing. My code is below:
The bit I dont know is what to put after 'Me.BackUpName, to reference the specific worksheet relevent to the table in Access.
Sheet names are the same as the table names as this would be getting restored from a backup!
This is part of a restore process that I am doing. My code is below:
Code:
Dim sSource As String 'The name of the file to be copied
sSource = "c:\Gundog Training Databases\BackUp\"
'Ask if you want to overwrite it
If MsgBox("Are you sure you want to restore an older version of your data?", vbQuestion + vbYesNo) = vbYes Then
'Copies the files from Excel
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "tbl_Animal", sSource & Me.BackUpName, True
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "tbl_Breed", sSource & Me.BackUpName, True
End if
Sheet names are the same as the table names as this would be getting restored from a backup!