E
eBob.com
I have a working app which creates an Excel spreadsheet via Interop. But
recently I've added a column of data, which, except for a header in row 1,
is all integers. All of the cells containing the integers have that little
green triangle saying I've put numeric data into a non-numeric column and
neither the column heading nor the integers are right justified.
My searches have found some hits which appear helpful but which do not work
for me. For example, based on one of the hits and some help from
Intellisense I came up with ...
Dim style As New Excel.Style
style.HorizontalAlignment = Excel.XlHAlign.xlHAlignRight
But Intellisense complains that New cannot be used on an Interface. If I
eliminate the New then, of course, I get a run time error.
Dim style as New Excel.CellFormat has the same problem.
The search hit which led me to the above conatined ...
Dim style as Microsoft.Office.Interop.Excel.Style
But Intellisense seems to know nothing about
"Microsoft.Office.Interop.Excel.Style". (And I don't understand how the
code gets away with no New!)
I also came up with ...
objSheet.Range("B:B").HorizontalAlignment = HorizontalAlignment.Right
which Intellisense liked and which caused no run time problem but which also
accomplished nothing.
So if anyone has any help or pointers for me I'd appreciate it. I'd guess
that my level of Excel matters. If so it's 2002 SP3. All I'm trying to do
is make some cells which contains integers numeric (to get rid of the green
triangle) and have the same cells right justified.
Thanks, Bob
recently I've added a column of data, which, except for a header in row 1,
is all integers. All of the cells containing the integers have that little
green triangle saying I've put numeric data into a non-numeric column and
neither the column heading nor the integers are right justified.
My searches have found some hits which appear helpful but which do not work
for me. For example, based on one of the hits and some help from
Intellisense I came up with ...
Dim style As New Excel.Style
style.HorizontalAlignment = Excel.XlHAlign.xlHAlignRight
But Intellisense complains that New cannot be used on an Interface. If I
eliminate the New then, of course, I get a run time error.
Dim style as New Excel.CellFormat has the same problem.
The search hit which led me to the above conatined ...
Dim style as Microsoft.Office.Interop.Excel.Style
But Intellisense seems to know nothing about
"Microsoft.Office.Interop.Excel.Style". (And I don't understand how the
code gets away with no New!)
I also came up with ...
objSheet.Range("B:B").HorizontalAlignment = HorizontalAlignment.Right
which Intellisense liked and which caused no run time problem but which also
accomplished nothing.
So if anyone has any help or pointers for me I'd appreciate it. I'd guess
that my level of Excel matters. If so it's 2002 SP3. All I'm trying to do
is make some cells which contains integers numeric (to get rid of the green
triangle) and have the same cells right justified.
Thanks, Bob