T
Type of Sheet displayed
I get this error when access the record attributes of the oObj. The crash
happens when the oObj.Get(Attributes(LoopCounter)) tries to pull data from an
attribute that has no value or a null, I am guessing. The database being
addressed used ADO to connect to and search an LDAP database. I have tried a
number of error handling techniques available to VBA for Excel but no good.
Still throws an exception that I cannot seem to trap so that I can reset and
just carry on to the next attribute. I am not new to development but fairly
new to VB and VBA specifically. The number of rows of data I am pulling with
this function ends up at 850 rows with about 30 attributes. This crashes on
any attribute with a null value.
Any ideas would be greatly appreciated. I am still surfing the web looking
to see if others have already discovered the answer. MSDN wasn't much help
as yet either.
Function PopulateRow(ByVal rsObj As Object, ByRef Attributes() As String,
ByVal _ RowNumber As Integer, ByVal columnNumber As Integer)
Dim LoopCounter As Integer
On Error Resume Next
' Populate a row of the spreadsheet with the Attributes from the
Metadirectory
Set CurrentCell = Cells(RowNumber, columnNumber)
LoopCounter = 0
' Go through the list of Attributes and add the Metadirectory value to
the spreadsheet
While (Len(Attributes(LoopCounter)) > 0)
Set Value = Nothing
Value = rsObj.Get(Attributes(LoopCounter))
' Put the value in the spreadsheet cell
CurrentCell.Value = Value
' Get the next attribute
LoopCounter = LoopCounter + 1
' Move over to the next cell (column)
Set CurrentCell = CurrentCell.Offset(0, 1)
Wend
End Function
Thanks,
Bryan44
happens when the oObj.Get(Attributes(LoopCounter)) tries to pull data from an
attribute that has no value or a null, I am guessing. The database being
addressed used ADO to connect to and search an LDAP database. I have tried a
number of error handling techniques available to VBA for Excel but no good.
Still throws an exception that I cannot seem to trap so that I can reset and
just carry on to the next attribute. I am not new to development but fairly
new to VB and VBA specifically. The number of rows of data I am pulling with
this function ends up at 850 rows with about 30 attributes. This crashes on
any attribute with a null value.
Any ideas would be greatly appreciated. I am still surfing the web looking
to see if others have already discovered the answer. MSDN wasn't much help
as yet either.
Function PopulateRow(ByVal rsObj As Object, ByRef Attributes() As String,
ByVal _ RowNumber As Integer, ByVal columnNumber As Integer)
Dim LoopCounter As Integer
On Error Resume Next
' Populate a row of the spreadsheet with the Attributes from the
Metadirectory
Set CurrentCell = Cells(RowNumber, columnNumber)
LoopCounter = 0
' Go through the list of Attributes and add the Metadirectory value to
the spreadsheet
While (Len(Attributes(LoopCounter)) > 0)
Set Value = Nothing
Value = rsObj.Get(Attributes(LoopCounter))
' Put the value in the spreadsheet cell
CurrentCell.Value = Value
' Get the next attribute
LoopCounter = LoopCounter + 1
' Move over to the next cell (column)
Set CurrentCell = CurrentCell.Offset(0, 1)
Wend
End Function
Thanks,
Bryan44