Program ini dibuat dari visual basic 6.0. Untuk export access ke Excel.
sebelum kita membuat program ini, selesikan terlebih dahulu tugas2 yg laen (yg blom makan-makan dulu, yg blom mand-mandi dulu, yg blom sholatjika sudah waktunya-sholat dulu)
karena jika sudah berinterakasi dengan komputer akan lupa segalanya.
- untuk memulai, langkah pertama buka program vb 6.0
- di menu pilih Project-References, kemudan ceklist:
– Microsoft Excel 11.0 Object Library
– Microsoft ActiveX Data Object 2.0 Library
- kemudian, buat buat 1 form dan command button
- setelah itu copy-paste source code di bawah ke form yg dibuat
‘—copy here—
Dim Con As New ADODB.Connection
Dim rst As New ADODB.RecordsetPrivate Sub Command1_Click()
Dim aa As New ExportExcel
aa.RecordSource = rst
aa.ExportToExcel
End SubPrivate Sub Form_Load()
Con.Open “Provider=Microsoft.Jet.OLEDB.4.0;Data Source=” & App.Path & “\data.mdb”
rst.Open “hardware”, Con
End Sub
‘—end—
- setelah source code di atas di paste ke form1, kemudian tambah 1 class modules–>Project-Add Class Module
- seteleh class module dibuat, kemudian copy-paste source code dibawah ke class module yg dibuat
‘—copy here—
Dim rs As ADODB.Recordset
Public Property Let RecordSource(m_rs As Recordset)
Set rs = m_rs
End PropertyPublic Sub ExportToExcel()
Dim App As Application
Dim Wb As Workbook
Dim Wk As Worksheet
Dim Baris As Long, Kolom As Integer
Set App = Excel.Application
Set Wb = App.Workbooks.Add
Set Wk = Wb.Worksheets(1)With rs
.MoveFirst
Baris = 1
Kolom = 0
For Kolom = 1 To rs.Fields.Count
Wk.Cells(1, Kolom) = rs.Fields(Kolom – 1).Name
Next Kolom
While Not .EOF
Baris = Baris + 1
For Kolom = 1 To rs.Fields.Count
Wk.Cells(Baris, Kolom) = rs.Fields(Kolom – 1)
Next Kolom
.MoveNext
Wend
End WithApp.Visible = True
Set Wk = Nothing
Set Wb = Nothing
Set App = Nothing
End Sub
‘—end—
- setelah itu di run, akan mucul form1. kemudian klik command buttonnya, akan mucul excel.
catatan:
- untuk databasenya dapat di download disini. kemudian taruh databasenya di dalam satu folder dengan project.
Klo ga mo pusing bisa download source codenya yg udah jadi disini.
-SELAMAT MENCOBA-
Filed under: VB 6.0








makacie yah source code vb-nya…
makasih mas,sc,kalau export data grid ke exel gmana?data basenya pakai acces,gridnya pakai component1 “tdbg7″,thxb4
klu boleh, Q minta tolong dong…!
kn skrang Q lagi bikin tgs program lwat VB…
trus ini tentang “data report”…!
maunya sih program-y tar bila data-y ud d filter trus ada tombol untk mengkonver hasil query/filter tadi menjadi file bentuk excel…!
trus gmn 2 source code…!!!!!????
Q bingung cara buat program agar bs mengkonver data dari access ke excel…!
tolong dong kirim “contoh program & source code” via e-mail…!
please nich menda2 banget…!
argakoesdewangga@yahoo.co.id
argakoesdewangga@gmail.com
linknya mati bos
aku juga lagi buat negh program yang sama
cuman pake Delphi, cek di http://kurnia.blog.uns.ac.id
minta code program minimarket
mas Kodenya ngak di 4sahrednya minta link yang lain donk
Data source yang uda jadi ngak ada filenya di 4shared minta di email donk makasih
mas.. pertanyaanku kayak Arga, cuma databasenya aku pake sql. tolong yah mas kasihtau source codenya kayak gimana.. kirim ke email aja mas..makasiih