Hi,
I created a function call based on this automation tutorial.
My calling function is as follows:
----------------------------------------
//get ws
IDispatch *pXlSheet;
{
VARIANT result;
VariantInit(&result);
AutoWrap(DISPATCH_PROPERTYGET, &result, pXlApp, L"ActiveSheet", 0);
pXlSheet = result.pdispVal;
}
//get hidden
VARIANT result;
AutoWrap(DISPATCH_PROPERTYGET, &result, pXlRow, L"Hidden", 0);
------------------------------------------------
for (int i = 1; i <= 100.000; i++)
{
IDispatch *row= getrow(pXlRows,i); //get dispatch row
Bool b = gethidden(row) //get row hidden property
vector[t++] = b;
}
then compare with:
Public Function test(rng As Range) As Variant
With ActiveSheet
k = rng.Row
rc = k + rng.Rows.Count - 1
Dim a() As Integer
ReDim a(1 To rc, 1 To 1)
For i = k To rc
a(i - k + 1, 1) = IIf(.Rows(i).Hidden, 1, 0)
Next
End With
test= a
End Function
I tested 100k rows and the result from the first method take me 5s and using vba run in 2s on Excel365 64bit, Win64bit core-I5
unbelievable, Is it still slower than vba? (I mean when working with the IDispatch*)
Thank you!