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

Bryan Carbonnell carbonnb at gmail.com
Fri Oct 29 09:46:53 CDT 2004


On Fri, 29 Oct 2004 15:33:06 +0100, Paul Hartland (ISHARP)
<paul.hartland at isharp.co.uk> wrote:
> Bryan,
> 
> Yes it's pointing to the Excel 8.0 object library, using Access 97.  The CSV
> file by the way has Unix end of line characters if that makes a
> difference...

Nope it shouldn't.

I just figured out what the problem may be:

The line:
Set objWB = objExcel.Workbooks.OpenText(strLoc)    ' NOTE: strLoc is a
path provided by the user

should be:
objExcel.Workbooks.OpenText strLoc


OpenText requires the Workbooks object.

You were trying to set a workbook (no s) object as the result of the OpenText.

If you need a reference to the workbook object that gets opened, you
can use this line:
Set objWB = objExcel.Workbooks.Open(strLoc) 

Hope this make sense.

-- 
Bryan Carbonnell - carbonnb at gmail.com
Life's journey is not to arrive at the grave safely in a well
preserved body, but rather to skid in sideways, totally worn out,
shouting "What a great ride!"



More information about the AccessD mailing list