PDA

Click to See Complete Forum and Search --> : excel


stweelman
Nov 7th, 1999, 09:18 AM
I'm writing a program that is to print out orderform using excel. I start by sorting the data in access database table, then use create to start excel, add a workbook, then add aworksheet. I belive that this is the point that is the problem. I call a sub giving the worksheet as an argument. This sub does some formating of the worksheet (i.e. collum width, rowhight, borders, ...)after that sub has ended the data from the database is placed on the worksheet. Then additional data is sorted a worksheet is added then handed to the formating sub. This happen till all the data has been placed on to the proper worksheet. At this point I delete the default worksheets(3of them).Then it is to print out the workbook. I do not want to ship a templet with the app. I need to know how to hand the worksheets off to the formating sub. and get them back to the calling sub so the data can be placed on them. Everything that I've try has locked up the whole system. Any idaes?????????

billwagnon
Nov 7th, 1999, 10:45 AM
Ideas-
1.reference Excel in your project references
2.in your sub that formats, use
With myExcel 'your Excel object
.selection.columnwidth = 15 'etc.
End With

the best way to do this part is to record it in Excel VBA, then cut and paste into your VB project. Once it is pasted, put the "." before the commands so VB knows you are talking about the Excel object.

If this still doesn't work, provide me with more details. I am assuming that you expect to have Excel on the end user's machine.