Export a Report to Excel with VB.net

  • Thread starter Thread starter David
  • Start date Start date
D

David

I am looking for an example of how to export an Access Report to an Excel
spreadsheet using VB.net. Can some one please point me in the right
direction.

Thank you

David
 
Imports Microsoft
Imports Microsoft.Office
Imports Microsoft.Office.Core
Imports Microsoft.Office.Interop
Imports Microsoft.Office.Interop.Access

Module Module1
Sub Main()
Dim app As New Access.Application
Try
app.AutomationSecurity = _
MsoAutomationSecurity.msoAutomationSecurityLow
app.OpenCurrentDatabase("c:\dsdata\db3.mdb")
app.DoCmd.OutputTo(AcOutputObjectType.acOutputReport, _
"rptTest", "Microsoft Excel (*.xls)", "c:\dsdata\test.xls")
Finally
app.CloseCurrentDatabase()
End Try
End Sub
End Module
 
Back
Top