Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
updating a safearray in C++
Can you update a SafeArray size after you have created the
SafeArray sizes ? Here is the code in C++: int TwoDimensionTableCount = 0; VARIANT TwoDimensionArray; void InitTable (int numberOfRows, int numberOfColumns) { VariantInit ( & TwoDimensionArray); TwoDimensionArray.vt = VT_ARRAY | VT_VARIANT; { SAFEARRAYBOUND sab[2]; sab[0].lLbound = 1; sab[0].cElements = numberOfRows; sab[1].lLbound = 1; sab[1].cElements = numberOfColumns; TwoDimensionArray.parray = SafeArrayCreate (VT_VARIANT, 2, sab); } TwoDimensionTableCount = 0; } Thanks, Lynn |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
updating a safearray in C++
Can you update a SafeArray size after you have created the
SafeArray sizes ? Here is the code in C++: int TwoDimensionTableCount = 0; VARIANT TwoDimensionArray; void InitTable (int numberOfRows, int numberOfColumns) { VariantInit ( & TwoDimensionArray); TwoDimensionArray.vt = VT_ARRAY | VT_VARIANT; { SAFEARRAYBOUND sab[2]; sab[0].lLbound = 1; sab[0].cElements = numberOfRows; sab[1].lLbound = 1; sab[1].cElements = numberOfColumns; TwoDimensionArray.parray = SafeArrayCreate (VT_VARIANT, 2, sab); } TwoDimensionTableCount = 0; } I figured out that the initial number of rows in the SafeArray does not matter as long as the SafeArray is big enough to hold all of the potential number of rows. However, the number of columns in the SafeArray cannot be varied. Hope this helps someone else, it was a pain to figure out. Lynn |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Problem passing a large safearray to Excel | Excel Programming | |||
Retrieve Excel Cell Range into SAFEARRAY (VC++) | Excel Programming | |||
SAFEARRAY [in] and [out] | Excel Programming | |||
When updating a worksheet, how do I create a link updating the sa. | Excel Worksheet Functions | |||
Fill a Range with VB SafeArray | Excel Programming |