Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old March 7th, 2008, 07:19 AM
Authorized User
Join Date: Feb 2008
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to hewstone999
Default Change the format of MS Excel Cells from MS Access

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 & "]"
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?

Similar Threads
Thread Thread Starter Forum Replies Last Post
MS ACCESS 2003 FRONTEND AND MS SQL SERVER 2005 DB mohankumar0709 SQL Server 2005 3 March 23rd, 2007 12:48 AM
Need to change MS Access 2000 Query gilgalbiblewheel Classic ASP Databases 0 June 13th, 2005 11:10 PM
Exporting data from MS Excel sheet to Ms Access ajindal General .NET 1 January 17th, 2005 03:00 AM
MS Access and ASP : DATE Format failure Sebastiaan Classic ASP Basics 2 October 1st, 2003 12:32 PM
SQL to change a column name in MS Access nidgep Classic ASP Databases 1 August 13th, 2003 10:52 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.