Technical Designs
tdd-inc at shaw.ca
Fri Oct 29 10:32:50 CDT 2004
Paul, In your line... strSaveAs = Left(strLoc,((Len(Trim(strLoc))-4)) & ".xls" shouldn't the left ( be equal to the right ) Phil -----Original Message----- From: Paul Hartland (ISHARP) [mailto:paul.hartland at isharp.co.uk] Sent: Friday, October 29, 2004 12:34 AM To: 'Access Developers discussion and problem solving' Subject: [AccessD] Open CSV file using Excel object and save as Excel To all, I have the following code in a database: Dim objExcel As Excel.Application Dim objWB As Excel.Workbook Dim strSaveAs As String Set objExcel = New Excel.Application Set objWB = objExcel.Workbooks.OpenText(strLoc) ' NOTE: strLoc is a path provided by the user strSaveAs = Left(strLoc,((Len(Trim(strLoc))-4)) & ".xls" objWB.SaveAs strSaveAs objWB.Close Set objWB = Nothing objExcel.Quit Set objExcel = Nothing This should be so simple but I get the following error message on the objExcel.Workbooks.OpenText line: Expected Function or Variable Can anyone help on this...... Thanks in advance for any help. PAUL HARTLAND Database Designer/Programmer paul.hartland at isharp.co.uk ISHARP DDI - 01922 472031 Mobile - 07730 523179 ISHARP (Information Services for Hospitality, Audit, Retail and Pharmacy) provide IT resources for the Christie Group Stock & Inventory Services companies.