Function FieldType(obj As Object, label As String) As String
FieldType = "string" 'default
Dim f As Integer
For f = LBound(obj.fields) To UBound(obj.fields)
Dim lc: lc = LCase(label)
If (lc = LCase(obj.fields(f).label) Or lc = LCase(obj.fields(f).name)) Then
FieldType = obj.fields(f).Type
Exit For
End If
Next f
' 5.05 If (FieldType = "") Then
' Error "invalid label -->" & label
' End If
End Function
When I'm using a SafeArray for obj.Fields it returns only the field Values but it contains field Labels, Names Types etc. which I need to retrieve.
Nobody knows?
Looks like this Safearray is uni-dimensional, each element has \vt = 9 (Dispatch) and being converted by VT_STR(*Var.Variant) it returns the \Value parameter but Excel can return \Name, \Label and \Type as well.
No idea how to do the same on PB...
Hi mk-soft,
Thanks, I'm using this add-in but it doesn't help in this case(
I think that iDispatch can point to another array but I have no enough knowledge to proof it and to extract the data
Thanks, I learned a little bit more and now at least I understand the meaning of fields
* SafeArray *
cDim: 1
cbElements: 16
* rgsabound *
cElements: 78
lLbound: 0
But the problem is that it is an array of objects... and here I'm losing the way
I tried to wrap it by COMate_WrapCOMObject() but COMate crashes on this so looks I do something wrong... totally...