Create an Excel Spread with multiple worksheets

hewstone999

Registered User.
Local time
Today, 13:26
Joined
Feb 27, 2008
Messages
37
I have a button that when I click on it, I want it to create an Excel Spreadsheet with 5 worksheets.

Also how can I change the cell formats in Excel from Access? i.e. I have an export function in Access that exports a table into excel, however I want to change the format in Excel i.e. Make the Column headings bold.

Any ideas how I can do this using Access VBA?
 
You can create what you want like this:

Code:
dim xlapp as excel.application
dim wb as excel.workbook
dim ws as excel.worksheet

set xlapp = new excel.application

set wb = xlapp.workbooks.add

do until wb.worksheets.count = 5

   wb.worksheets.add

loop

To change a cell format so it's bold then it would be doen like this:

Code:
thisworkbook.worksheets("sheetName").range("A1:E1").font.bold = true
 
Or you can cut and paste chergh's code - :)
 

Users who are viewing this thread

Back
Top Bottom