Thanbor
asked on
Excel Formatting from VB
I've got my application to build a spreadsheet, but now I want to make that spreadsheet look good. I need to adjust cell alignments, font face size and weight, row height, column width, set borders, freeze a pane at the top, and protect the whole sheet. How is this done? Where do I find help references for Excel.Application methods and properties?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
For information on Excel.Application, start here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odeopg/html/deovrunderstandingexcelapplicationobject.asp
And for more specific information, search http://msdn.microsoft.com
With regards to formatting your sheet, the easiest way to let Excel do the work for you:
1) Open an Excel sheet
2) Start recording a macro (Tools -> Macros)
3) Perform the formatting you want to know how to do
4) Stop the macro recording
Now, check the source code of the macro in Excel's Visual Basic Editor (Tools -> Macros -> Visual Basic Editor) - most of the code you need will already be in there, you just need to adapt it to work with the Excel.Application object.
Matt
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odeopg/html/deovrunderstandingexcelapplicationobject.asp
And for more specific information, search http://msdn.microsoft.com
With regards to formatting your sheet, the easiest way to let Excel do the work for you:
1) Open an Excel sheet
2) Start recording a macro (Tools -> Macros)
3) Perform the formatting you want to know how to do
4) Stop the macro recording
Now, check the source code of the macro in Excel's Visual Basic Editor (Tools -> Macros -> Visual Basic Editor) - most of the code you need will already be in there, you just need to adapt it to work with the Excel.Application object.
Matt
ASKER
Thx a lot. Very helpful.
(probably cou can also change the rest like this way)
.Range("B6:I16").NumberFor
.Range("B6:I16").FontColor