hewstone999
Registered User.
- Local time
- Today, 10:32
- Joined
- Feb 27, 2008
- Messages
- 37
Dim strExcelFile As String
Dim strWorksheet As String
Dim strDB As String
Dim strTable As String
Dim objDB As Database
strExcelFile = "E:\CSC\LDMS\LDMSDatabaseApp\LDMS_Spec.xls"
strWorksheet = "WorkSheet1"
strDB = strFilePath & "LDMS_IFF_APP.mdb"
strTable = "TEST_DOC"
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 " & "[" & strTable & "]"
objDB.Close
Set objDB = Nothing
End Sub
The code above export table "TEST_DOC" to an excel Spreadsheet "WorkSheet1". From the code, how can I change the format of the cells in Excel i.e. make the Table headings Bold. Is there a way to do this from Access?
Dim strWorksheet As String
Dim strDB As String
Dim strTable As String
Dim objDB As Database
strExcelFile = "E:\CSC\LDMS\LDMSDatabaseApp\LDMS_Spec.xls"
strWorksheet = "WorkSheet1"
strDB = strFilePath & "LDMS_IFF_APP.mdb"
strTable = "TEST_DOC"
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 " & "[" & strTable & "]"
objDB.Close
Set objDB = Nothing
End Sub
The code above export table "TEST_DOC" to an excel Spreadsheet "WorkSheet1". From the code, how can I change the format of the cells in Excel i.e. make the Table headings Bold. Is there a way to do this from Access?