how to bold rows/cells in excel from VB
I have a VB app that populates an excel spreadsheet very successfully, but now I want to do some formatiing and haven't a clue how.
I've done
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlDataSheet As Excel.Worksheet
Dim xlSumSheet As Excel.Worksheet
Set xlApp = New Excel.Application
Set xlBook = xlApp.Workbooks.Open _
("c:\gandalf\template.xls", , True)
Set xlDataSheet = xlBook.Worksheets("Data")
Set xlSumSheet = xlBook.Worksheets("Sums")
to open up the excel file and a couple of worksheets, and I push data into them with no problem and can close and save, so my content is where I want it and now I'm interested in cosmetics.
I'd like to have row 3 in the "Data" sheet become all bold, and I'd like cell (5,2) in the Sums sheet to become bold
I'd appreciate any guidance.
still can't get range to go bold
sure sounds like the right thing to do, and I apprecieate the guidance, but I can't get it to work:
xlDataSheet.Range("B2:B20").Select
gets me "select method of range class failed"
so does
xlDataSheet.Range("2:2").Select
and
xlDataSheet.Range("2:20").Select
on the other hand,
xlDataSheet.Range("2").Select
gets me "method range of objext worksheet failed"
clearly I'm missing something fundamental, but have no idea what it is.