Which actual line raises the error?
(I hate errors like this...)
Since this kind of error involve machinery not described in the documentation, changes that would appear to be unrelated sometime can make a difference.
Try eliminating the With block, and being explicit instead.
Try
Code:
' Hide all but the Total column.
For i = 0 To .Splits(0).Columns.Count - 1
If .Splits(1).Columns(i).DataField = "Total" _
Then .Splits(1).Columns(i).Visible = True
If .Splits(1).Columns(i).DataField <> "Total" _
Then .Splits(1).Columns(i).Visible = False
Next i
or
Code:
' Hide all but the Total column.
Code:
For i = 0 To .Splits(0).Columns.Count - 1
Dim bVis As Boolean
bVis = .Splits(1).Columns(i).DataField = "Total"
.Splits(1).Columns(i).Visible = bVis
Next i
or
Code:
' Hide all but the Total column.
For i = 0 To .Splits(0).Columns.Count - 1
With .Splits(1).Columns(i)
.Visible = (.DataField = "Total")
End With
Next i
I mean, all of these âorâs are just ways to try to get the compiled code to behave in some different way, that might skip over the resultant instruction that raises the error condition...