jameshopper
Technical User
Hi all,
I am trying to get the below piece of code to work, but it keeps hanging whenever one of the spreadsheets is opened by someone else. There is a password on each of the sheets, so I know it's not that thats causing issues as it opens the first few and then as soon as theres a spreadsheet it can't open in edit mode, it just sits there, depsite the error trapping.
Any help on this would be appreciated.
Thanks
James
Function IMPORT_DAILYFIGS()
DoCmd.SetWarnings False
counter = 1
Lmax = DMax("[Expr1]", "Teams Prod Sheets Current Month")
DoCmd.OpenQuery "Delete Data Prod Sheets Feeder"
Do Until counter = Lmax + 1
On Error GoTo IMPORT_DAILYFIGS_Err
Manager = DLookup("[Manager]", "Teams Prod Sheets Current Month", "[Expr1]=" & counter)
DoCmd.TransferSpreadsheet acImport, 8, "PROD SHEETS Feed", "filename" & Manager & " Oct 2007.xls", True, "MTD!A5:BX31"
counter = counter + 1
Loop
DoCmd.OpenQuery "Append Prod Sheets", acViewNormal, acEdit
IMPORT_DAILYFIGS_Exit:
Exit Function
IMPORT_DAILYFIGS_Err:
MsgBox Error$
Resume IMPORT_DAILYFIGS_Exit
End Function
I am trying to get the below piece of code to work, but it keeps hanging whenever one of the spreadsheets is opened by someone else. There is a password on each of the sheets, so I know it's not that thats causing issues as it opens the first few and then as soon as theres a spreadsheet it can't open in edit mode, it just sits there, depsite the error trapping.
Any help on this would be appreciated.
Thanks
James
Function IMPORT_DAILYFIGS()
DoCmd.SetWarnings False
counter = 1
Lmax = DMax("[Expr1]", "Teams Prod Sheets Current Month")
DoCmd.OpenQuery "Delete Data Prod Sheets Feeder"
Do Until counter = Lmax + 1
On Error GoTo IMPORT_DAILYFIGS_Err
Manager = DLookup("[Manager]", "Teams Prod Sheets Current Month", "[Expr1]=" & counter)
DoCmd.TransferSpreadsheet acImport, 8, "PROD SHEETS Feed", "filename" & Manager & " Oct 2007.xls", True, "MTD!A5:BX31"
counter = counter + 1
Loop
DoCmd.OpenQuery "Append Prod Sheets", acViewNormal, acEdit
IMPORT_DAILYFIGS_Exit:
Exit Function
IMPORT_DAILYFIGS_Err:
MsgBox Error$
Resume IMPORT_DAILYFIGS_Exit
End Function