VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Suppose you want to Export a set of Data to an Excel format. In this case we are using a .csv file

by RayMal (Ray & Mal) (1 Submission)
Category: Files/File Controls/Input/Output
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Tue 30th September 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Suppose you want to Export a set of Data to an Excel format. In this case we are using a .csv file (which opens in Excel). We found itVery

Rate Suppose you want to Export a set of Data to an Excel format. In this case we are using a .csv file



On Error Resume Next
Adodc1.Refresh
c = 0
Open app.Path & "\LISTEX.csv" For Append As #1
Write #1, c, Label1, Label2, Label3, Label4, Label5, Label6, Label7, Label8
Close #1

Do While Not Adodc1.Recordset.EOF
c = c + 1

Call textfile

Adodc1.Recordset.MoveNext
Loop
If Adodc1.Recordset.EOF = True Then Adodc1.Refresh
MsgBox "Your csv file is ready. CLICK 'OPTIONS / View csv File to see the file you have created."
Frame1.Visible = False
End Sub


Private Sub textfile()
'allows you to make headers
Open app.Path & "\LISTEX.csv" For Append As #1

Write #1, c, Adodc1.Recordset.Fields(Label1.Caption), Adodc1.Recordset.Fields(Label2.Caption), Adodc1.Recordset.Fields(Label3.Caption), Adodc1.Recordset.Fields(Label4.Caption), Adodc1.Recordset.Fields(Label5.Caption), Adodc1.Recordset.Fields(Label6.Caption), Adodc1.Recordset.Fields(Label7.Caption), Adodc1.Recordset.Fields(Label8.Caption)

Close #1

End Sub

Download this snippet    Add to My Saved Code

Suppose you want to Export a set of Data to an Excel format. In this case we are using a .csv file Comments

No comments have been posted about Suppose you want to Export a set of Data to an Excel format. In this case we are using a .csv file . Why not be the first to post a comment about Suppose you want to Export a set of Data to an Excel format. In this case we are using a .csv file .

Post your comment

Subject:
Message:
0/1000 characters