funderburgh
Registered User.
- Local time
- Today, 16:24
- Joined
- Jun 25, 2008
- Messages
- 118
I learned about late binding to an Excel object today when I tried to distribute my slick new version of the application I maintain to workstations with older versions of Excel.
Well I have late binding working (it seems) but I am getting errors on a couple of formatting statements that were working before: Here is a code example:
xlsheet.Range(xlsheet.Cells(HeadingRow, 1), xlsheet.Cells(HeadingRow, TargetCol)).HorizontalAlignment = xlCenter
' Bold The Column Titles/Change Fonts
xlsheet.Range(xlsheet.Cells(HeadingRow, 1), xlsheet.Cells(HeadingRow, TargetCol)).Font.Bold = True
xlsheet.Range(xlsheet.Cells(HeadingRow, 1), xlsheet.Cells(HeadingRow, TargetCol)).Font.Size = 11
I am getting a run-time error saying that the Horizontal Alignment can't be used with the Range. The formatting statements that follow (with the exact same Range syntax) work fine. I am getting the same result on SORT with Range.
So it's not the Range specifically, because I can change the font with the same syntax - I can't figure out what is different with Alignment and Sort. I really need the Sort.
Any ideas are welcome.
Well I have late binding working (it seems) but I am getting errors on a couple of formatting statements that were working before: Here is a code example:
xlsheet.Range(xlsheet.Cells(HeadingRow, 1), xlsheet.Cells(HeadingRow, TargetCol)).HorizontalAlignment = xlCenter
' Bold The Column Titles/Change Fonts
xlsheet.Range(xlsheet.Cells(HeadingRow, 1), xlsheet.Cells(HeadingRow, TargetCol)).Font.Bold = True
xlsheet.Range(xlsheet.Cells(HeadingRow, 1), xlsheet.Cells(HeadingRow, TargetCol)).Font.Size = 11
I am getting a run-time error saying that the Horizontal Alignment can't be used with the Range. The formatting statements that follow (with the exact same Range syntax) work fine. I am getting the same result on SORT with Range.
So it's not the Range specifically, because I can change the font with the same syntax - I can't figure out what is different with Alignment and Sort. I really need the Sort.
Any ideas are welcome.