Invoking Range.SpecialCells using IDispatch.Invoke
Go to vba window in excel and select menu view - Object Browser.
In the object browser box next to the binoculars put in xlcelltype and press
the binoculars to perform a search.
You can now click on any of the types such as xlCellTypeAllFormatConditions.
You will see the interger value sof each of the types.
xlCellTypeAllFormatConditions = -4172 (&HFFFFEFB4)
xlCellTypeAllValidation = -4174 (&HFFFFEFB2)
xlCellTypeBlanks = 4
xlCellTypeComments = -4144 (&HFFFFEFD0)
xlCellTypeConstants = 2
xlCellTypeFormulas = -4123 (&HFFFFEFE5)
xlCellTypeLastCell = 11
xlCellTypeSameFormatConditions = -4173 (&HFFFFEFB3)
xlCellTypeSameValidation = -4175 (&HFFFFEFB1)
xlCellTypeVisible = 12
I'm not sure how an integer and long are defined in your software. You ned
to reserve 16 bits for the parameter. The xlcelltype is required for the
function. It is not a variant. The xlcelltype is the format of the data you
want to copy.
"Raja" wrote:
Hi,
I'm writing a method in XLL add-in for excel 2007 using the ComInterop to
call Range.SpecialCells using iDispatch.Invoke. but how I can pack the
XlCellType as Variant?
I've tried to provide the int value of the enum but it didn't work:
...
VariantInit(&lCellType);
lCellType.vt = VT_INT;
lCellType.intVal = -4123;
hr = AutoWrap(DISPATCH_METHOD,&lResult, pCellRef/*pionter to Range*/,
L"SpecialCells", &lCellType);
Any idea?
Regards,
Raja
|