Steve Conklin (Developer@UltraDNT)
Developer at UltraDNT.com
Mon Nov 22 12:32:39 CST 2004
How about: DoCmd.TransferSpreadsheet acLink, acSpreadsheetTypeExcel9, "sheet1", "c:\temp\receipts.xls", True, "a1:h100" Hth Steve -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Colby, John Sent: Monday, November 22, 2004 12:53 PM To: 'AccessD at DatabaseAdvisors.com' Subject: [AccessD] Linking to an excel spreadsheet Does anyone have code for linking to an excel spreadsheet? If I manually create a link, the wizard finds all the fields, sets up with the "first line has field names" etc. Everything works fine. However if the table is not linked already, I need to create a tabledef, set the SourceTableName and Connect properties. If I then try to append the tabledef to db.tabledefs I get an error that no fields are defined. It is obvious that a LOT more is involved here. It appears that I have to open the spreadsheet, get the first line, create fields with the data in the first line, somehow figure out the datatype of each column etc. Is there a prebuilt code I can call to do all this stuff? If the wizard can do it, then the code behind the wizard could do it for me. Has anyone ever done this? John W. Colby The DIS Database Guy -- _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com