Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Will this work??? 1

Status
Not open for further replies.

dnfrantum

Programmer
Oct 23, 2001
175
US
I am trying to count the number of lines in file1 and append that number and some other data to file2. Then create and append file2 to file3 and finally append file1.

Esentially, I want file3 to be file2 + file3. Does my code support that? I am new to VB.

Code:
Private Sub Form_Load()

Dim fso1, fso2, fso3, a, b, c
Dim Count As Long

Set fso1 = CreateObject("Scripting.FileSystemObject")
    
    Set a = fso1.OpenTextFile("D:\Partner_Supplemental_Info\Amazon\datafeedout\SQL\products_tmp.txt", 1, False, 0)
    Do While a.readline = True
    Count = Count + 1
    Loop
    
Set fso2 = CreateObject("Scripting.FileSystemObject")
    Set b = fso2.OpenTextFile("D:\Partner_Supplemental_Info\Amazon\datafeedout\SQL\tmp_info_container.txt", 8, True, 0)
    Dim count_data As String
    Dim file_type As String
    count_data = Count
    file_type = "Product"
    b.WriteLine (count_data + file_type + datetimestamp +  )
    b.Close

Set fso3 = CreateObject("Scripting.FileSystemObject")
Set c = fso3.CreateTextFile("D:\Partner_Supplemental_Info\Amazon\datafeedout\Amazon_Products.txt", True)
Dim SomeString As String
c.Write (a.readall())
c.Write (b.readall())
c.Close
        
End Sub

Thanks in advance,
Donald
 
it looks ok to me.

not sure about this line though.
Code:
b.WriteLine (count_data + file_type + datetimestamp +  )

I dont think that extra + shourld be there at the end.
 
I didn't finish that line.

Thanks in advance,
Donald
 
How about the count_data = count? I am putting a long into a string. Will that work?

Thanks in advance,
Donald
 
Probably Not,

Try
[tt]
count_data = str(Count)
[/tt]

This turn Count into a string for writing.

Hope this helps...

jgjge3.gif
[tt]"Very funny, Scotty... Now Beam down my clothes."[/tt]
 
There is no need to convert it to a string using the str function. VB does it automatically for you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top