View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
eli silverman[_2_] eli silverman[_2_] is offline
external usenet poster
 
Posts: 2
Default Using vb to create an excel object and save it as a CSV file

I am using the following code from a VB app to create an excel object, populate some information and then save the excel file
Dim oExcel As Objec
Dim oBook As Objec
Dim oSheet As Objec
Set oExcel = CreateObject("Excel.Application"
Set oBook = oExcel.workbooks.Ad
Set oSheet = oBook.Worksheets(1
oSheet.Range("A1").Value = "EntryNumber
oSheet.Range("B1").Value = "CheckNumber
oSheet.Range("C1").Value = "CheckAmount
oSheet.Range("D1").Value = "InvoiceNumber
oSheet.Range("E1").Value = "invoicetype
oBook.Saveas rptpath & "\cashreceipts.xls
oExcel.qui
although not displayed here I am populating the worksheet with the results of an ADODB recordse
using the copyfromrecordset method
This works fine but I actually want to save the file in CSV format.
i saw the .fileformat property in excel but can't seem to get it to work properly.
Any suggestions on how to get my existing code to save the file as a csv would be greatly appreciated
Thanks in advance.