How can I format the Excel Spreadsheet I export from MS Access us.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to format specific cells which I exported from MS Access using
TransferSpreadsheet. Assuming I exported an entire table from Access, I now
want to format the first row in the spreadsheet with font color say "red" and
maybe have borders on certain cells etc.

Is this possible?
 
Hi Meenu,

You need to use Automation to launch Excel, open the workbook Access has
just created, and adjust the formats. In the VBA editor, to go
Tools|References and set a reference to the Excel object model, then
write code something vaguely like this. strFileSpec should contain the
path to the workbook, and strSheetName should usually contain the name
of the table or query you exported.

Dim oBook As Excel.Workbook

Set oBook = GetObject(strFileSpec)

With oBook.Worksheets(strSheetName)
.Rows(1).Font.Color = vbBlue
End With

oBook.Save
oBook.Close
Set oBook = Nothing
 
Back
Top