PC Review


Reply
Thread Tools Rate Thread

CSV file has ,,,,,below last data row

 
 
=?Utf-8?B?UGVyaWNv?=
Guest
Posts: n/a
 
      20th Jan 2007
I generate a csv file from Access , creating an Excel object. The csv is for
upload into an Oracle database. Using Notepad, I see rows and rows of
,,,,,,,,,,,,,,,, after the last data row. I thought adding a row count
parameter to CopyFromRecordset would help...

CopyFromRecordset rsCSVmst, rowCount, iCount

.... would cure the problem. It didn't. I then tweaked the line:

xlWbMst.SaveAs Filename:=fNameMst, FileFormat:=6

trying constants 20, 23. Still, didn't work. How do I eliminate those
empty rows of commas in my resulting CSV file?

The query from which the dao object is built has no blank rows.
Here's the code:
Dim xlWbMst As Object
Dim IStartedXL As Boolean
Dim i As Integer, iCount As Integer, rowCount As Long

IStartedXL = False
'PUT IF OBJECT NOT EXIST CREATE IT HERE?
On Error Resume Next
Set xlAppMst = GetObject(, "Excel.Application")
On Error GoTo 0
If xlAppMst Is Nothing Then
Set xlAppMst = CreateObject("Excel.Application")
IStartedXL = True
End If

Set xlWbMst = xlAppMst.Workbooks.Add

Dim rsCSVmst As DAO.Recordset
Set rsCSVmst = db.OpenRecordset("qtmpMasterCSV")
iCount = rsCSVmst.Fields.Count
rowCount = rsCSVmst.RecordCount

xlAppMst.Range("A1").Select
For i = 0 To iCount - 1
xlAppMst.Cells(1, i + 1).Value = rsCSVmst.Fields(i).Name
Next i
i = 0

xlAppMst.Range("A2").CopyFromRecordset rsCSVmst, rowCount, iCount
xlWbMst.SaveAs Filename:=fNameMst, FileFormat:=6
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to change the type of office data file to personal data file Hani Microsoft Outlook Discussion 1 4th Jun 2008 04:27 PM
how to change the type of office data file to personal data file Hani Microsoft Outlook Discussion 0 4th Jun 2008 08:42 AM
Open external data (varying file names) and closing file once data is retrieved Corrie Microsoft Excel Programming 2 31st Dec 2006 09:56 PM
Data Entered in Copied File Changes Data in Original File =?Utf-8?B?S00=?= Microsoft Excel Crashes 0 22nd Nov 2006 01:01 AM
Unable to access data file management; data file open or rename? =?Utf-8?B?REdMMDE=?= Microsoft Outlook Discussion 1 24th Jun 2005 03:32 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:11 AM.