Hi Sir,
I have a code in a command button to export data from access to excel. it looks like........
Private Sub Command47_Click()
'Export function
'EXPORTS TABLE IN ACCESS DATABASE TO EXCEL
'REFERENCE TO DAO IS REQUIRED
Dim strExcelFile As String
Dim strWorksheet As String
Dim strDB As String
Dim strQuery As String
Dim objDB As Database
'Change Based on your needs, or use
'as parameters to the sub
strExcelFile = "F:\Project\Somenath_Report1.xls"
strWorksheet = "WorkSheet1"
strDB = "F:\Project\Software Hardware1"
strQuery = "Somenath"
Set objDB = OpenDatabase(strDB)
'If excel file already exists, you can delete it here
If Dir(strExcelFile) <> "" Then Kill strExcelFile
objDB.Execute _
"SELECT * INTO [Excel 8.0;DATABASE=" & strExcelFile & _
"].[" & strWorksheet & "] FROM " & "[" & strQuery & "]"
objDB.Close
Set objDB = Nothing
End Sub
It works Fine. But i want my Excel file to be a bit formatted. Headers in Bold and as per the size of field and if possible apply cell border. Is it possible? If yes, can anyone provide me with codes?
I am new in Access.
Regards
Saikat