[AccessD] Open CSV file using Excel object and save as Excel

Paul Hartland (ISHARP) paul.hartland at isharp.co.uk
Fri Oct 29 02:33:45 CDT 2004


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.

 



More information about the AccessD mailing list