Read the formating of an excel column?
I'm having to read a spreadsheet, and depending on if the column is indented or not, store the value.
If the field's formatting is indented, I ignore it, it if isn't, I store it.
I read the field's value like this...
VB Code:
myVariable = exll.Worksheets(TabName).Cells(12, 1).Value.ToString
But how can I read how the field is formatted??
So it would end up something to the effect of ...
VB Code:
if ( exll.Worksheets(TabName).Cells(12, 1).FORMAT_IS_CORRECT ?? )then
myVariable = exll.Worksheets(TabName).Cells(12, 1).Value.ToString
else
myVariable = "Skipped Value"
End If
Re: Read the formating of an excel column?
You cna look at the "AddIndent" property of the cell. If this property is TRUE, then the cell is indented, if FALSE it isn't.
VB Code:
If exll.Worksheets(TabName).Cells(12, 1).AddIndent = False Then
myVariable = exll.Worksheets(TabName).Cells(12, 1).Value.ToString
Else
myVariable = "Skipped Value"
End If
Re: Read the formating of an excel column?
.AddIndent always returned false. I think it has to do with the way production formatted the spreadsheet, but I'm not sure.
I'm using .IndentLevel and it is working well.
I appreciate the help.
Re: Read the formating of an excel column?
Hmmm, are you sure the cells are truely indentred, or could it be that they have leading spaces?