Wempi Satria Wempi Satria

Berlangganan

Isikan alamat email:

Google PageRank Checker

Komentar Terakhir

Sponsor Wempi


Banner 400x50

Simpan Data ListView ke Format Excel 97-2003
Bimbingan - Pemrograman
Jumat, 12 September 2008 15:51

Kode berikut ini adalah Prosedur/Fungsi untuk menyimpan data dari ListView ke Microsoft Excel 97-2003 (xls format) dari Visual Basic 6.0

Sebelum menggunakan kode ini reference Microsoft Excel Object Library project harus di set aktif

Contoh: Call pFuncGenerateExcel (lvwMain, "C:\report.xls")

Public Sub pFuncGenerateExcel(ByRef objListview As ListView, strOutputPath As String)

Dim xlApp As Object
Dim xlBook As Workbook
Dim xlsheet As Object
Dim i As Integer
Dim s As String
Dim lst As ListItem
Dim lst1 As ListSubItem
Dim row As Integer
Dim col As Integer

Set xlApp = New Excel.Application
Set xlBook = xlApp.Workbooks.Add
Set xlsheet = xlBook.Worksheets.Item(1)

row = 1
col = 1
For i = 1 To objListview.ColumnHeaders.Count
xlsheet.Cells(row, col) = objListview.ColumnHeaders(i)
col = col + 1
Next
col = 1
row = row + 1
For Each lst In objListview.ListItems
col = 1
xlsheet.Cells(row, col) = lst.Text
col = col + 1
For Each lst1 In lst.ListSubItems
xlsheet.Cells(row, col) = lst1.Text
col = col + 1
Next
row = row + 1
Next
xlBook.Close savechanges:=True, FileName:="" & strOutputPath & ""

xlApp.Quit
End Sub

Sumber : http://www.originalpinoy.com/2008/06/export-listview-control-to-microsoft.html



 

Comments  

 
0 #11 Zultrisno 2011-12-06 23:39
Thanks Bro atas Infonya
Quote | Report to administrator
 
 
0 #10 Nthan 2010-09-02 21:07
Thanksss wempii......artikelnya bagus.....!!!!

sangat berguna.....
Quote | Report to administrator
 
 
0 #9 NoksPi 2010-07-23 08:22
#8. itu sudah otomatis kebukak kok
Quote | Report to administrator
 
 
0 #8 gagas 2010-07-23 04:18
kl biar otomatis abis save buka excelnya gmana yah tq mas
Quote | Report to administrator
 
 
0 #7 Wempi 2010-01-18 01:30
copy aja code di atas mulai dari public sub sampai end sub.

untuk memanggilnya copy Call pFuncGenerateEx cel (lvwMain, "C:\report.xls") di salah satu tombol program aplikasi yang anda buat.

perhatikan/samakan name listview di program aplikasi anda dengan code yang dicopy dari web ini.
Quote | Report to administrator
 
 
0 #6 De 2010-01-18 00:43
mo nanya, klu cara nge-save dari listview gmn? udah di looping trus dari pake ex: listview1.listitems(i).listsubitem(0).text ga berhasil.....
ada ide lain ga???
Quote | Report to administrator
 
 
0 #5 get pregnant fast 2009-11-23 06:12
Terima kasih untuk posting ini
Quote | Report to administrator
 
 
0 #4 Wempi 2008-10-10 15:15
:-) terimakasih kembali
Quote | Report to administrator
 
 
0 #3 Pangeran Perang 2008-10-10 00:13
Terima kasih banget ku ucapkan untuk yang punya ini website... Tugas kantor gw kebantu banget... abis gw lupa..


Thanks..
War Prince
:-) :-) :-)
Quote | Report to administrator
 
 
0 #2 Wempi 2008-09-18 21:20
sama-sama
Quote | Report to administrator
 

Add comment


Security code
Refresh

Wempi Satria
Wempi NoksPi
Plugin Joomla AutoSEO 1.2 by geekspace.free.fr