Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Transferspreadsheet importing from Excel - Read only

Status
Not open for further replies.

jameshopper

Technical User
Jun 2, 2005
11
GB
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top