There is another code which I found on Microsoft forums and tried. It worked for me. All it does that it can help you to export the databse in a new sheet of said Excel file. So that you can later on rename the same as you want.
Code:
Dim AccessConn As New System.Data.OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Documents and Settings\...\My Documents\My Database\Access\database.accdb;")
AccessConn.Open()
'New sheet in Workbook
Dim AccessCommand As New System.Data.OleDb.OleDbCommand("SELECT * INTO [Excel 12.0 Xml;DATABASE=C:\Users\...\Documents\My Database\Excel\Excelfile.xlsx;HDR=Yes;].[Customers] from [Customers]", AccessConn)
AccessCommand.ExecuteNonQuery()
AccessConn.Close()
Bookmarks