Contoh Konversi/export ke Excel

Pada saat event Klik pada Command Button

Private Sub Command1_Click()
Dim XL As Excel.Application
Dim wb As Workbook
Dim ws As Worksheet
Set XL = New Excel.Application
‘membuat file baru
Set wb = XL.Workbooks.Add
‘membuat sheet baru
Set ws = wb.Worksheets.Add
‘memakai sheet 1
Set ws = wb.Worksheets(1)
‘mengakses object cell
ws.Cells(6, 5) = “Hello world”
‘mengakses object range
ws.Range(“b2:e6”).Font.Color = vbRed
‘atau
ws.Range(ws.Cells(2, 2), ws.Cells(6, 6)).Font.Color = vbRed
ws.Range(“b2:e6”).Font.Size = 28
ws.Range(“b2:e6”).BorderAround 1, xlThick, 10
XL.Visible = True
End Sub

 

Private Sub cmdExport_Click()

Dim xl As Excel.Application

Dim wb As Excel.Workbook

Dim ws As Excel.Worksheet

Dim i As Integer

Set xl = New Excel.Application

Set wb = xl.Workbooks.Add

Set ws = wb.Worksheets.Add

Set ws = wb.Worksheets(1)

For i = 0 To List1.ListCount – 1

ws.Cells((i + 1) * 3, 2) = “Nama=” & List1.List(i)

ws.Cells(((i + 1) * 3) + 1, 2) = “Alamat=” & List2.List(i)

ws.Range(ws.Cells((i + 1) * 3, 2), ws.Cells(((i + 1) * 3) + 1, 3)).BorderAround 1, xlThick, 10

Next i

xl.Visible = True

End Sub

Private Sub cmdTambah_Click()

List1.AddItem (Text1.Text)

List2.AddItem (Text2.Text)

End Sub

Private Sub Form_Load()

For i = 1 To 1000

Call cmdTambah_Click

Next i

End Sub

Kalau ada yang butuh contoh program Laporan konversi/export ke Excel lebih lanjut Hubungi saya ya di 081 3307 154 10(Irawan)😀

Saya akan kirim kan cd program nya, butuh transfer 50rb untuk ongkos kirim.

2 Tanggapan

  1. mas gmn cara mengekspor nilai kuis flash ke exel ?

    mohon bantuannya

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: