อยากทราบวิธีนำข้อมูลจากตัวแปรที่มีไปสร้างไฟล์excelแล้วเซฟเก็บทำได้ดังนี้ครับ
--------------------
1. add referece ก่อน โดยไปที่เมนู้ project >> add reference >> com >> microsoft excel 10 object library
2. ทำการ เขียนโค้ดในปุ่ม ดังนี้
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
Dim app As New Excel.Application
Dim exbook As Excel.Workbook
Dim exsheet As Excel.Worksheet
exbook = app.Workbooks.Add
exsheet = exbook.Sheets(1)
Dim xx As Integer = 2
exsheet.Cells(xx, 1) = "ddd"
exsheet.Cells(xx, 2) = "dddd"
exbook.SaveAs("C:\took1.xls"
app.Visible = True
MsgBox("complete"
Exit Sub
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
http://bbznet.pukpik.com/scripts2/view.php?user=siam2mobile&board=9&id=17&c=1&order=numtopic