Call OpenText from Access

D

dlevine54

I have an Access database from which I create a CSV file. Now they want an
XLS spreadsheet also. Since I already have the CSV I want to use that to
create the spreadsheet but can't. I'm using Office 2003. My code is below.

Dim oExcel As Object
Dim oBook As Excel.Workbook
Dim oBooks As Excel.Workbooks
Dim oSheets As Excel.Sheets
Dim oSheet As Excel.Worksheet

' Open the excel spreedsheet
Set oExcel = CreateObject("Excel.Application")
Set oBook = oExcel.Workbooks.Add()
Set oBook = oExcel.Workbooks.OpenText(CSV_doc_name, StartRow:=3, _
DataType:=Excel.XlTextParsingType.xlDelimited, Comma:=True)
oBook.Close
Set oExcel = Nothing

I keep getting an 'Object is required' error on the OpenText line. Can
someone help me understand why?

Thanks.
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?ZGxldmluZTU0?=,
I keep getting an 'Object is required' error on the OpenText line. Can
someone help me understand why?
If you haven't got this figured out, yet, you might try asking in an
EXCEL newsgroup. The Excel experts only get here when things are really
slow in the app-specific groups :)

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top