D
DoctorV3774 via AccessMonster.com
I have the following function which works great. It imports every workbook
in the folder path listed and appends it into Tbl_Data.
I just need to make some adjustments for this.
How can I adjust this IF
1) the Workbook and/or the Sheet is Password protected
2) range in hidden sheet
3) there are multiple sheets
Any assistance most appreciated!!!!!
Function ImportFireFighterForms()
'Change field names in Tbl_Data to F1, F2 etc
'Change the strPath to the path location of the files._
'If you need to add more columns Add addional F8, F9 fields as Text 255
or memo in Tbl_Data
'Change DBOutput!A2:H2 to more columns if necessary
'Set references to DAO 3.6 Library and Excel Library
Dim strPath As String
Dim strFile As String
On Error Resume Next
strPath = "C:\FireFighterForm\"
strFile = Dir(strPath & "*.xls")
While strFile <> ""
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9,
"tbl_Data", strPath & strFile, False, "DBOutput!A2:h2"
strFile = Dir()
Wend
End Function
in the folder path listed and appends it into Tbl_Data.
I just need to make some adjustments for this.
How can I adjust this IF
1) the Workbook and/or the Sheet is Password protected
2) range in hidden sheet
3) there are multiple sheets
Any assistance most appreciated!!!!!
Function ImportFireFighterForms()
'Change field names in Tbl_Data to F1, F2 etc
'Change the strPath to the path location of the files._
'If you need to add more columns Add addional F8, F9 fields as Text 255
or memo in Tbl_Data
'Change DBOutput!A2:H2 to more columns if necessary
'Set references to DAO 3.6 Library and Excel Library
Dim strPath As String
Dim strFile As String
On Error Resume Next
strPath = "C:\FireFighterForm\"
strFile = Dir(strPath & "*.xls")
While strFile <> ""
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9,
"tbl_Data", strPath & strFile, False, "DBOutput!A2:h2"
strFile = Dir()
Wend
End Function