Export Access file to Excel in VB.net.

  • Thread starter Thread starter sam
  • Start date Start date
Hello,

sam said:
Can you teach me how to export access file to excel file
in VB.net?

You may want to ask in the Access ngs (microsoft.public.access[.*]). Then
you can translate the solution to VB .NET.

HTH,
Herfried K. Wagner
 
¤
¤ Can you teach me how to export access file to excel file
¤ in VB.net?

You can do it a table at a time:

Public Sub ExportToExcelFromAccess()

Dim AccessConn As New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;"
& _
"Data Source=e:\My Documents\db1.mdb")

AccessConn.Open()

'New sheet in Workbook
Dim AccessCommand As New System.Data.OleDb.OleDbCommand("SELECT * INTO [Excel
8.0;DATABASE=e:\My Documents\Book11.xls;HDR=NO;].[Sheet7] from [Table7]", AccessConn)

AccessCommand.ExecuteNonQuery()
AccessConn.Close()

End Sub


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
Back
Top