Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 469
Default method or data member not found

code from web says it will do what I want Will run on sheet I use xx.xx
hangs on
..CreateTextFile
tswrite.writeline OutPutLine on writeline
have suggested code to test works fine

Dim FSO As Scripting.FileSystemObject
Dim AAA As Scripting.TextStream
Set FSO = New Scripting.FileSystemObject
Set AAA = FSO.CreateTextFile("C:\Parade\ZZZ.txt")

do't know what I've got wrong in this is it another setting in references?
Following is download from web
'The code below will write a CSV file and will not output anything for a
blank line
Sub WriteCSV()
Dim fwrite As Variable
Dim fswrite As Variable
Dim WritePathName As Variable
Dim writeline As Variable
Dim CreateTextFile As Variable
Const MyPath = "C:\Parade\"
Const WriteFileName = "text.csv"
Const Delimiter = ","
Const ForReading = 1, ForWriting = 2, ForAppending = 3
Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0
Set fswrite = CreateObject("Scripting.FileSystemObject")
'open files
WritePathName = MyPath + WriteFileName
fswrite.CreateTextFile WritePathName
Set fwrite = fswrite.GetFile(WritePathName)
Set tswrite = fwrite.OpenAsTextStream(ForWriting, TristateUseDefault)

lastrow = Cells(Rows.Count, "A").End(xlUp).row

For RowCount = 1 To lastrow
lastcol = Cells(RowCount, Columns.Count).End(xlToLeft).Column
For ColCount = 1 To lastcol
If ColCount = 1 Then
OutPutLine = Cells(RowCount, ColCount)
Else
OutPutLine = OutPutLine & Delimiter & Cells(RowCount, ColCount)
End If
Next ColCount
OutPutLine = Trim(OutPutLine)
If Len(OutPutLine) < 0 Then
tswrite.writeline OutPutLine
End If
Next RowCount

tswrite.Close

End Sub

' 65,536 rows in the csv file. Is there something I can do, within Excel,
' preferably programatically, to ensure that only rows with data are
presented for import.

If this can be whipped I sure will be a happy person
Thanks for help


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
method or data member not found Curt Excel Programming 0 April 29th 08 04:39 PM
Error 461-Method or data member not found shorticake Excel Programming 3 November 15th 07 03:42 PM
Compile Error: Method or data member not found Nick S[_2_] Excel Programming 1 November 16th 04 11:41 AM
Method or data member not found No Name Excel Programming 1 September 19th 04 02:42 PM
Method of Data Member not found TroyH[_4_] Excel Programming 1 September 6th 04 11:36 PM


All times are GMT +1. The time now is 01:43 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"