ambushsinger said:
I've programmatically created a new tab in an excel workbook and I'm having
trouble formatting the header cell text. I want to bold the text and then
format the rest of the column as a percent with only one decimal place.
The code below is what I have so far.
Any ideas??
TJ
Range("AD1") = "Percent"
Cells("AD1").font.bold
The following is some sample code I pulled out of some of my working
code.
Set objSht = objWkb.Worksheets(conSheetName)
With objSht
.....
' Bold the column heading row
.range(.Cells(1, 1), .Cells(1, iCountOfCols)).Font.Bold = True
Also consider late binding once you get things working.
Late binding means you can safely remove the reference and only have
an error when the app executes lines of code in question. Rather than
erroring out while starting up the app and not allowing the users in
the app at all. Or when hitting a mid, left or trim function call.
This also is very useful when you don't know version of the external
application will reside on the target system. Or if your organization
is in the middle of moving from one version to another.
For more information including additional text and some detailed links
see the "Late Binding in Microsoft Access" page at
http://www.granite.ab.ca/access/latebinding.htm
Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog -
http://msmvps.com/blogs/access/